diff options
| author | Kim F. Storm | 2002-02-09 22:58:25 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2002-02-09 22:58:25 +0000 |
| commit | 73df3b72f653c4c6ff557d2165672bab3e80a391 (patch) | |
| tree | 25c0c747070fc5041c70942592ad018fe222ae8a /src | |
| parent | 06f5e6b48fba006c412178dee0b24a5030acd779 (diff) | |
| download | emacs-73df3b72f653c4c6ff557d2165672bab3e80a391.tar.gz emacs-73df3b72f653c4c6ff557d2165672bab3e80a391.zip | |
(make_gap_smaller): Preserve BEG_UNCHANGED during gap
reduction. This fixes a display problem where stray newlines were
inserted in the window (corrected by C-l). Clarified code (IMHO).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/insdel.c | 19 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 044eb6c75a5..a7bb9948838 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2002-02-09 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * insdel.c (make_gap_smaller): Preserve BEG_UNCHANGED during gap | ||
| 4 | reduction. This fixes a display problem where stray newlines were | ||
| 5 | inserted in the window (corrected by C-l). Clarified code (IMHO). | ||
| 6 | |||
| 1 | 2002-02-09 Eli Zaretskii <eliz@is.elta.co.il> | 7 | 2002-02-09 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 8 | ||
| 3 | * dispextern.h (CURRENT_MODE_LINE_FACE_ID): Fix last change. | 9 | * dispextern.h (CURRENT_MODE_LINE_FACE_ID): Fix last change. |
diff --git a/src/insdel.c b/src/insdel.c index 486875d2b91..365819b2cff 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -584,7 +584,8 @@ make_gap_smaller (nbytes_removed) | |||
| 584 | int real_gap_loc_byte; | 584 | int real_gap_loc_byte; |
| 585 | int real_Z; | 585 | int real_Z; |
| 586 | int real_Z_byte; | 586 | int real_Z_byte; |
| 587 | int old_gap_size; | 587 | int real_beg_unchanged; |
| 588 | int new_gap_size; | ||
| 588 | 589 | ||
| 589 | /* Make sure the gap is at least 20 bytes. */ | 590 | /* Make sure the gap is at least 20 bytes. */ |
| 590 | if (GAP_SIZE - nbytes_removed < 20) | 591 | if (GAP_SIZE - nbytes_removed < 20) |
| @@ -596,18 +597,19 @@ make_gap_smaller (nbytes_removed) | |||
| 596 | 597 | ||
| 597 | real_gap_loc = GPT; | 598 | real_gap_loc = GPT; |
| 598 | real_gap_loc_byte = GPT_BYTE; | 599 | real_gap_loc_byte = GPT_BYTE; |
| 599 | old_gap_size = GAP_SIZE; | 600 | new_gap_size = GAP_SIZE - nbytes_removed; |
| 600 | real_Z = Z; | 601 | real_Z = Z; |
| 601 | real_Z_byte = Z_BYTE; | 602 | real_Z_byte = Z_BYTE; |
| 603 | real_beg_unchanged = BEG_UNCHANGED; | ||
| 602 | 604 | ||
| 603 | /* Pretend that the last unwanted part of the gap is the entire gap, | 605 | /* Pretend that the last unwanted part of the gap is the entire gap, |
| 604 | and that the first desired part of the gap is part of the buffer | 606 | and that the first desired part of the gap is part of the buffer |
| 605 | text. */ | 607 | text. */ |
| 606 | bzero (GPT_ADDR, GAP_SIZE - nbytes_removed); | 608 | bzero (GPT_ADDR, new_gap_size); |
| 607 | GPT += GAP_SIZE - nbytes_removed; | 609 | GPT += new_gap_size; |
| 608 | GPT_BYTE += GAP_SIZE - nbytes_removed; | 610 | GPT_BYTE += new_gap_size; |
| 609 | Z += GAP_SIZE - nbytes_removed; | 611 | Z += new_gap_size; |
| 610 | Z_BYTE += GAP_SIZE - nbytes_removed; | 612 | Z_BYTE += new_gap_size; |
| 611 | GAP_SIZE = nbytes_removed; | 613 | GAP_SIZE = nbytes_removed; |
| 612 | 614 | ||
| 613 | /* Move the unwanted pretend gap to the end of the buffer. This | 615 | /* Move the unwanted pretend gap to the end of the buffer. This |
| @@ -617,11 +619,12 @@ make_gap_smaller (nbytes_removed) | |||
| 617 | enlarge_buffer_text (current_buffer, -nbytes_removed); | 619 | enlarge_buffer_text (current_buffer, -nbytes_removed); |
| 618 | 620 | ||
| 619 | /* Now restore the desired gap. */ | 621 | /* Now restore the desired gap. */ |
| 620 | GAP_SIZE = old_gap_size - nbytes_removed; | 622 | GAP_SIZE = new_gap_size; |
| 621 | GPT = real_gap_loc; | 623 | GPT = real_gap_loc; |
| 622 | GPT_BYTE = real_gap_loc_byte; | 624 | GPT_BYTE = real_gap_loc_byte; |
| 623 | Z = real_Z; | 625 | Z = real_Z; |
| 624 | Z_BYTE = real_Z_byte; | 626 | Z_BYTE = real_Z_byte; |
| 627 | BEG_UNCHANGED = real_beg_unchanged; | ||
| 625 | 628 | ||
| 626 | /* Put an anchor. */ | 629 | /* Put an anchor. */ |
| 627 | *(Z_ADDR) = 0; | 630 | *(Z_ADDR) = 0; |