summaryrefslogtreecommitdiff
path: root/src/indent.c
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2004-11-22 11:06:39 +0000
committerKaroly Lorentey <lorentey@elte.hu>2004-11-22 11:06:39 +0000
commit71925ac335f7c3b1fd97fba98cb5b9b4f03a6e23 (patch)
tree63f61c3bebc83c114c16f31dd4ac2b9c0fe17c7d /src/indent.c
parente417405015c93c81641f5c4a33ec898b5c353772 (diff)
parent83aebfe62204109f19ef7dcca5429c1ddad21c57 (diff)
downloademacs-71925ac335f7c3b1fd97fba98cb5b9b4f03a6e23.tar.gz
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-694 Update from CVS * 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 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-698 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-699 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-700 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-701 Update from CVS * 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 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-705 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-706 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-707 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-708 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-709 Update from CVS: src/indent.c (Fvertical_motion): Fix last change. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-710 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-711 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-712 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-713 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 git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-268
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/src/indent.c b/src/indent.c
index 99fca1c2ff7..d2e8a83c11c 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2063,21 +2063,41 @@ 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
+ {
+ int it_start;
+
+ 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. */
+ it_start = IT_CHARPOS (it);
+ 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) > it_start && 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;