aboutsummaryrefslogtreecommitdiffstats
path: root/src/indent.c
diff options
context:
space:
mode:
authorStefan Monnier2008-06-05 03:57:09 +0000
committerStefan Monnier2008-06-05 03:57:09 +0000
commitc876b227d9b0cbd09bbb8c07db0a3cb0d85fae78 (patch)
tree36b9cdbe3c2af0181b8e074c80a98e1119597f03 /src/indent.c
parent927abf37e2793fae653540cca8b4c324c65e448f (diff)
downloademacs-c876b227d9b0cbd09bbb8c07db0a3cb0d85fae78.tar.gz
emacs-c876b227d9b0cbd09bbb8c07db0a3cb0d85fae78.zip
* 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.c17
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
1993parameters such as width, horizontal scrolling, and so on. 1993parameters such as width, horizontal scrolling, and so on.
1994The default is to use the selected window's parameters. 1994The default is to use the selected window's parameters.
1995 1995
1996LINES can optionally take the form (COLS . LINES), in which case
1997the motion will not stop at the start of a screen line but on
1998its column COLS (if such exists on that line, that is).
1999
1996`vertical-motion' always uses the current buffer, 2000`vertical-motion' always uses the current buffer,
1997regardless of which buffer is displayed in WINDOW. 2001regardless of which buffer is displayed in WINDOW.
1998This is consistent with other cursor motion functions 2002This is consistent with other cursor motion functions
@@ -2006,6 +2010,14 @@ whether or not it is currently displayed in some window. */)
2006 struct window *w; 2010 struct window *w;
2007 Lisp_Object old_buffer; 2011 Lisp_Object old_buffer;
2008 struct gcpro gcpro1; 2012 struct gcpro gcpro1;
2013 int cols = 0;
2014
2015 /* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */
2016 if (CONSP (lines) && (NUMBERP (XCAR (lines))))
2017 {
2018 cols = XINT (XCAR (lines));
2019 lines = XCDR (lines);
2020 }
2009 2021
2010 CHECK_NUMBER (lines); 2022 CHECK_NUMBER (lines);
2011 if (! NILP (window)) 2023 if (! NILP (window))
@@ -2094,6 +2106,11 @@ whether or not it is currently displayed in some window. */)
2094 if (XINT (lines) >= 0 || IT_CHARPOS (it) > 0) 2106 if (XINT (lines) >= 0 || IT_CHARPOS (it) > 0)
2095 move_it_by_lines (&it, XINT (lines), 0); 2107 move_it_by_lines (&it, XINT (lines), 0);
2096 2108
2109 if (cols)
2110 move_it_in_display_line (&it, ZV,
2111 cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)),
2112 MOVE_TO_X);
2113
2097 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 2114 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
2098 } 2115 }
2099 2116