diff options
| author | Kenichi Handa | 2002-08-21 13:07:13 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-08-21 13:07:13 +0000 |
| commit | 372de96a628179274bc8c673591d7aca28615c79 (patch) | |
| tree | 297eaf33618163994eeb7fdaae06d26d67b6678d /src | |
| parent | 28f67a95f75c02270e65c8e9d9d7e9c14f7e5b41 (diff) | |
| download | emacs-372de96a628179274bc8c673591d7aca28615c79.tar.gz emacs-372de96a628179274bc8c673591d7aca28615c79.zip | |
(insert_from_gap): Make it work even if PT != GTP.
Diffstat (limited to 'src')
| -rw-r--r-- | src/insdel.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/insdel.c b/src/insdel.c index 1f3cff6e8fd..f782a88320d 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1038,19 +1038,16 @@ insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers) | |||
| 1038 | } | 1038 | } |
| 1039 | 1039 | ||
| 1040 | /* Insert a sequence of NCHARS chars which occupy NBYTES bytes | 1040 | /* Insert a sequence of NCHARS chars which occupy NBYTES bytes |
| 1041 | starting at GPT_ADDR. This funciton assumes PT == GPT. */ | 1041 | starting at GPT_ADDR. */ |
| 1042 | 1042 | ||
| 1043 | void | 1043 | void |
| 1044 | insert_from_gap (nchars, nbytes) | 1044 | insert_from_gap (nchars, nbytes) |
| 1045 | register int nchars, nbytes; | 1045 | register int nchars, nbytes; |
| 1046 | { | 1046 | { |
| 1047 | if (PT != GPT) | ||
| 1048 | abort (); | ||
| 1049 | |||
| 1050 | if (NILP (current_buffer->enable_multibyte_characters)) | 1047 | if (NILP (current_buffer->enable_multibyte_characters)) |
| 1051 | nchars = nbytes; | 1048 | nchars = nbytes; |
| 1052 | 1049 | ||
| 1053 | record_insert (PT, nchars); | 1050 | record_insert (GPT, nchars); |
| 1054 | MODIFF++; | 1051 | MODIFF++; |
| 1055 | 1052 | ||
| 1056 | GAP_SIZE -= nbytes; | 1053 | GAP_SIZE -= nbytes; |
| @@ -1065,15 +1062,16 @@ insert_from_gap (nchars, nbytes) | |||
| 1065 | if (GPT_BYTE < GPT) | 1062 | if (GPT_BYTE < GPT) |
| 1066 | abort (); | 1063 | abort (); |
| 1067 | 1064 | ||
| 1068 | adjust_overlays_for_insert (PT, nchars); | 1065 | adjust_overlays_for_insert (GPT, nchars); |
| 1069 | adjust_markers_for_insert (PT, PT_BYTE, | 1066 | adjust_markers_for_insert (GPT, GPT_BYTE, |
| 1070 | PT + nchars, PT_BYTE + nbytes, | 1067 | GPT + nchars, GPT_BYTE + nbytes, |
| 1071 | 0); | 1068 | 0); |
| 1072 | 1069 | ||
| 1073 | if (BUF_INTERVALS (current_buffer) != 0) | 1070 | if (BUF_INTERVALS (current_buffer) != 0) |
| 1074 | offset_intervals (current_buffer, PT, nchars); | 1071 | offset_intervals (current_buffer, PT, nchars); |
| 1075 | 1072 | ||
| 1076 | adjust_point (nchars, nbytes); | 1073 | if (GPT - nchars < PT) |
| 1074 | adjust_point (nchars, nbytes); | ||
| 1077 | 1075 | ||
| 1078 | CHECK_MARKERS (); | 1076 | CHECK_MARKERS (); |
| 1079 | } | 1077 | } |