diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-06-05 03:57:09 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-06-05 03:57:09 +0000 |
commit | c876b227d9b0cbd09bbb8c07db0a3cb0d85fae78 (patch) | |
tree | 36b9cdbe3c2af0181b8e074c80a98e1119597f03 /src/indent.c | |
parent | 927abf37e2793fae653540cca8b4c324c65e448f (diff) | |
download | emacs-c876b227d9b0cbd09bbb8c07db0a3cb0d85fae78.tar.gz |
* window.c (window_scroll_pixel_based_preserve_x)
(window_scroll_preserve_hpos, window_scroll_preserve_vpos): New vars.
(window_scroll_pixel_based, window_scroll_line_based):
Use them to preserve column positions.
(syms_of_window): Initialize them.
* indent.c (Fvertical_motion): Extend first arg to allow passing an
(HPOS . VPOS) pair.
* xdisp.c (move_it_in_display_line_to): Improve the type of its args.
(move_it_in_display_line): New wrapper.
* dispextern.h (move_it_in_display_line): Declare.
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/indent.c b/src/indent.c index 9d69936d440..fdc042bc9e4 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1993,6 +1993,10 @@ The optional second argument WINDOW specifies the window to use for parameters such as width, horizontal scrolling, and so on. The default is to use the selected window's parameters. +LINES can optionally take the form (COLS . LINES), in which case +the motion will not stop at the start of a screen line but on +its column COLS (if such exists on that line, that is). + `vertical-motion' always uses the current buffer, regardless of which buffer is displayed in WINDOW. This is consistent with other cursor motion functions @@ -2006,6 +2010,14 @@ whether or not it is currently displayed in some window. */) struct window *w; Lisp_Object old_buffer; struct gcpro gcpro1; + int cols = 0; + + /* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */ + if (CONSP (lines) && (NUMBERP (XCAR (lines)))) + { + cols = XINT (XCAR (lines)); + lines = XCDR (lines); + } CHECK_NUMBER (lines); if (! NILP (window)) @@ -2094,6 +2106,11 @@ whether or not it is currently displayed in some window. */) if (XINT (lines) >= 0 || IT_CHARPOS (it) > 0) move_it_by_lines (&it, XINT (lines), 0); + if (cols) + move_it_in_display_line (&it, ZV, + cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)), + MOVE_TO_X); + SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); } |