summaryrefslogtreecommitdiff
path: root/src/indent.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2004-11-19 06:55:13 +0000
committerMiles Bader <miles@gnu.org>2004-11-19 06:55:13 +0000
commit148396568043f50499340911c656c7234cefd50d (patch)
tree6bb3c035d0194f7e26bc8254a5189cb5a8722ce2 /src/indent.c
parent77229aad98d5c81a559fb1ba5161ed2a7f13aec4 (diff)
parent6dd06769a945f59e048d8328e37a77b41f8c798f (diff)
downloademacs-148396568043f50499340911c656c7234cefd50d.tar.gz
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-72
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-693 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-695 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-696 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-697 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-702 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-703 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-704 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-708 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-72 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-73 Merge from emacs--cvs-trunk--0
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/indent.c b/src/indent.c
index 874662cc47c..5b2faba7fda 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2061,21 +2061,38 @@ whether or not it is currently displayed in some window. */)
XSETBUFFER (w->buffer, current_buffer);
}
- SET_TEXT_POS (pt, PT, PT_BYTE);
- start_display (&it, w, pt);
-
- /* Move to the start of the display line containing PT. If we don't
- do this, we start moving with IT->current_x == 0, while PT is
- really at some x > 0. The effect is, in continuation lines, that
- we end up with the iterator placed at where it thinks X is 0,
- while the end position is really at some X > 0, the same X that
- PT had. */
- move_it_by_lines (&it, 0, 0);
-
- if (XINT (lines) != 0)
- move_it_by_lines (&it, XINT (lines), 0);
-
- SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
+ if (noninteractive)
+ {
+ struct position pos;
+ pos = *vmotion (PT, XINT (lines), w);
+ SET_PT_BOTH (pos.bufpos, pos.bytepos);
+ }
+ else
+ {
+ SET_TEXT_POS (pt, PT, PT_BYTE);
+ start_display (&it, w, pt);
+
+ /* Scan from the start of the line containing PT. If we don't
+ do this, we start moving with IT->current_x == 0, while PT is
+ really at some x > 0. The effect is, in continuation lines, that
+ we end up with the iterator placed at where it thinks X is 0,
+ while the end position is really at some X > 0, the same X that
+ PT had. */
+ reseat_at_previous_visible_line_start (&it);
+ it.current_x = it.hpos = 0;
+ move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
+
+ /* Move back if we got too far. This may happen if
+ truncate-lines is on and PT is beyond right margin. */
+ if (IT_CHARPOS (it) > PT && XINT (lines) > 0)
+ move_it_by_lines (&it, -1, 0);
+
+ it.vpos = 0;
+ if (XINT (lines) != 0)
+ move_it_by_lines (&it, XINT (lines), 0);
+
+ SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
+ }
if (BUFFERP (old_buffer))
w->buffer = old_buffer;