diff options
author | Karl Heuer <[email protected]> | 1994-04-08 00:44:35 +0000 |
---|---|---|
committer | Karl Heuer <[email protected]> | 1994-04-08 00:44:35 +0000 |
commit | 395ec62efe4fc1a970356ffd3cf163496152eea2 (patch) | |
tree | 15ec251bd549be3928665e690d4155dcdc0628ca /src | |
parent | 25e907da8b54041d823bd0852536b9956e2fcfe2 (diff) |
(insert_1): New function, extracted from insert.
(insert_from_string_1): Likewise, taken from insert_from_string.
(insert, insert_from_string): Call the new functions.
(insert_before_markers, insert_from_string_before_markers): Adjust the markers
before calling the after-change function.
Diffstat (limited to 'src')
-rw-r--r-- | src/insdel.c | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/src/insdel.c b/src/insdel.c index 6d5986e6fe..06cd05d4eb 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -25,6 +25,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "window.h" #include "blockinput.h" +static void insert_1 (); +static void insert_from_string_1 (); + /* Move gap to position `pos'. Note that this can quit! */ @@ -284,10 +287,19 @@ insert (string, length) register unsigned char *string; register length; { - register Lisp_Object temp; + if (length > 0) + { + insert_1 (string, length); + signal_after_change (point-length, 0, length); + } +} - if (length < 1) - return; +static void +insert_1 (string, length) + register unsigned char *string; + register length; +{ + register Lisp_Object temp; /* Make sure point-max won't overflow after this insertion. */ XSET (temp, Lisp_Int, length + Z); @@ -314,8 +326,6 @@ insert (string, length) ZV += length; Z += length; SET_PT (point + length); - - signal_after_change (point-length, 0, length); } /* Insert the part of the text of STRING, a Lisp object assumed to be @@ -332,12 +342,22 @@ insert_from_string (string, pos, length, inherit) register int pos, length; int inherit; { + if (length > 0) + { + insert_from_string_1 (string, pos, length, inherit); + signal_after_change (point-length, 0, length); + } +} + +static void +insert_from_string_1 (string, pos, length, inherit) + Lisp_Object string; + register int pos, length; + int inherit; +{ register Lisp_Object temp; struct gcpro gcpro1; - if (length < 1) - return; - /* Make sure point-max won't overflow after this insertion. */ XSET (temp, Lisp_Int, length + Z); if (length + Z != XINT (temp)) @@ -370,8 +390,6 @@ insert_from_string (string, pos, length, inherit) current_buffer, inherit); SET_PT (point + length); - - signal_after_change (point-length, 0, length); } /* Insert the character C before point */ @@ -401,9 +419,13 @@ insert_before_markers (string, length) unsigned char *string; register int length; { - register int opoint = point; - insert (string, length); - adjust_markers (opoint - 1, opoint, length); + if (length > 0) + { + register int opoint = point; + insert_1 (string, length); + adjust_markers (opoint - 1, opoint, length); + signal_after_change (point-length, 0, length); + } } /* Insert part of a Lisp string, relocating markers after. */ @@ -413,9 +435,13 @@ insert_from_string_before_markers (string, pos, length, inherit) register int pos, length; int inherit; { - register int opoint = point; - insert_from_string (string, pos, length, inherit); - adjust_markers (opoint - 1, opoint, length); + if (length > 0) + { + register int opoint = point; + insert_from_string_1 (string, pos, length, inherit); + adjust_markers (opoint - 1, opoint, length); + signal_after_change (point-length, 0, length); + } } /* Delete characters in current buffer |