aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-09-03 18:51:47 +0000
committerRichard M. Stallman1995-09-03 18:51:47 +0000
commitbeecb55b9eaa374924a9dc34a9ea372e45c3d972 (patch)
tree48b0bb891b71f6496e948630b91ce6c9ef8bd4fd /src
parent6a4cd60590cea4afbfe5296054945a953495b4c1 (diff)
downloademacs-beecb55b9eaa374924a9dc34a9ea372e45c3d972.tar.gz
emacs-beecb55b9eaa374924a9dc34a9ea372e45c3d972.zip
(adjust_markers_for_insert): New function.
(insert_from_buffer_1, insert_from_string_1, insert_1): Call it.
Diffstat (limited to 'src')
-rw-r--r--src/insdel.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/insdel.c b/src/insdel.c
index 2a6438b9bcb..cd46d0f4dcf 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -246,6 +246,26 @@ adjust_markers (from, to, amount)
246 } 246 }
247} 247}
248 248
249/* Adjust markers whose insertion-type is t
250 for an insertion of AMOUNT characters at POS. */
251
252static void
253adjust_markers_for_insert (pos, amount)
254 register int pos, amount;
255{
256 Lisp_Object marker;
257
258 marker = BUF_MARKERS (current_buffer);
259
260 while (!NILP (marker))
261 {
262 register struct Lisp_Marker *m = XMARKER (marker);
263 if (m->insertion_type && m->bufpos == pos)
264 m->bufpos += amount;
265 marker = m->chain;
266 }
267}
268
249/* Add the specified amount to point. This is used only when the value 269/* Add the specified amount to point. This is used only when the value
250 of point changes due to an insert or delete; it does not represent 270 of point changes due to an insert or delete; it does not represent
251 a conceptual change in point as a marker. In particular, point is 271 a conceptual change in point as a marker. In particular, point is
@@ -377,6 +397,7 @@ insert_1 (string, length, inherit, prepare)
377 ZV += length; 397 ZV += length;
378 Z += length; 398 Z += length;
379 adjust_overlays_for_insert (PT, length); 399 adjust_overlays_for_insert (PT, length);
400 adjust_markers_for_insert (PT, length);
380 adjust_point (length); 401 adjust_point (length);
381 402
382#ifdef USE_TEXT_PROPERTIES 403#ifdef USE_TEXT_PROPERTIES
@@ -444,6 +465,7 @@ insert_from_string_1 (string, pos, length, inherit)
444 ZV += length; 465 ZV += length;
445 Z += length; 466 Z += length;
446 adjust_overlays_for_insert (PT, length); 467 adjust_overlays_for_insert (PT, length);
468 adjust_markers_for_insert (PT, length);
447 469
448 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ 470 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
449 graft_intervals_into_buffer (XSTRING (string)->intervals, PT, length, 471 graft_intervals_into_buffer (XSTRING (string)->intervals, PT, length,
@@ -519,6 +541,7 @@ insert_from_buffer_1 (buf, pos, length, inherit)
519 ZV += length; 541 ZV += length;
520 Z += length; 542 Z += length;
521 adjust_overlays_for_insert (PT, length); 543 adjust_overlays_for_insert (PT, length);
544 adjust_markers_for_insert (PT, length);
522 adjust_point (length); 545 adjust_point (length);
523 546
524 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ 547 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */