Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
a27a38d8
Commit
a27a38d8
authored
Apr 26, 1994
by
Karl Heuer
Browse files
(adjust_point): New function.
(insert_1, insert_from_string_1, del_range_1): Use it.
parent
2bcaed71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
src/insdel.c
src/insdel.c
+17
-8
No files found.
src/insdel.c
View file @
a27a38d8
...
...
@@ -30,6 +30,7 @@ static void insert_from_string_1 ();
static
void
gap_left
();
static
void
gap_right
();
static
void
adjust_markers
();
static
void
adjust_point
();
/* Move gap to position `pos'.
Note that this can quit! */
...
...
@@ -241,6 +242,19 @@ adjust_markers (from, to, amount)
marker
=
m
->
chain
;
}
}
/* Add the specified amount to point. This is used only when the value
of point changes due to an insert or delete; it does not represent
a conceptual change in point as a marker. In particular, point is
not crossing any interval boundaries, so there's no need to use the
usual SET_PT macro. In fact it would be incorrect to do so, because
either the old or the new value of point is out of synch with the
current set of intervals. */
static
void
adjust_point
(
amount
)
{
current_buffer
->
text
.
pt
+=
amount
;
}
/* Make the gap INCREMENT characters longer. */
...
...
@@ -331,7 +345,7 @@ insert_1 (string, length)
GPT
+=
length
;
ZV
+=
length
;
Z
+=
length
;
SET_PT
(
PT
+
length
);
adjust_point
(
length
);
}
/* Insert the part of the text of STRING, a Lisp object assumed to be
...
...
@@ -395,7 +409,7 @@ insert_from_string_1 (string, pos, length, inherit)
graft_intervals_into_buffer
(
XSTRING
(
string
)
->
intervals
,
PT
,
length
,
current_buffer
,
inherit
);
SET_PT
(
PT
+
length
);
adjust_point
(
length
);
}
/* Insert the character C before point */
...
...
@@ -489,12 +503,7 @@ del_range_1 (from, to, prepare)
/* Relocate point as if it were a marker. */
if
(
from
<
PT
)
{
if
(
PT
<
to
)
SET_PT
(
from
);
else
SET_PT
(
PT
-
numdel
);
}
adjust_point
(
from
-
(
PT
<
to
?
PT
:
to
));
/* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
offset_intervals
(
current_buffer
,
from
,
-
numdel
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment