diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2008-07-12 03:19:38 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2008-07-12 03:19:38 +0000 |
commit | 2f4ec7ce4fe0cb5036a919abdc101a611202ffd2 (patch) | |
tree | eb9cf2b4a8de2355c770538c1facd94207d51bc7 /src/indent.c | |
parent | e433031a1afbb91cf0404a39ea4daa672a618b08 (diff) | |
download | emacs-2f4ec7ce4fe0cb5036a919abdc101a611202ffd2.tar.gz |
(Fvertical_motion): Restore hscroll before moving to goal column.
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/indent.c b/src/indent.c index be5dc5f667f..d556cd87748 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2055,12 +2055,11 @@ whether or not it is currently displayed in some window. */) } else { - int it_start; - int oselective; - int it_overshoot_expected; + int it_start, oselective, it_overshoot_expected, first_x; SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); + first_x = it.first_visible_x; /* 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 @@ -2118,11 +2117,21 @@ 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); + /* Move to the goal column, if one was specified. */ if (!NILP (lcols)) - move_it_in_display_line - (&it, ZV, - (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5), - MOVE_TO_X); + { + /* If the window was originally hscrolled, move forward by + the hscrolled amount first. */ + if (first_x > 0) + { + move_it_in_display_line (&it, ZV, first_x, MOVE_TO_X); + it.current_x = 0; + } + move_it_in_display_line + (&it, ZV, + (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5), + MOVE_TO_X); + } SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); } |