aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-07-18 15:17:26 +0300
committerEli Zaretskii2015-07-18 15:17:26 +0300
commita65e00b9f9b486debdbd9ec2fc584ce1967dba44 (patch)
tree3702f1e7e79581594cdffa61add732e42cbf7556 /src
parent166ffcb6c7a012ed5f655d7bb0fad97319ad54fc (diff)
downloademacs-a65e00b9f9b486debdbd9ec2fc584ce1967dba44.tar.gz
emacs-a65e00b9f9b486debdbd9ec2fc584ce1967dba44.zip
Fix visual-order cursor movement when lines are truncated
* src/xdisp.c (Fmove_point_visually): When lines are truncated, simulate display in a window of infinite width, to allow move_it_* functions reach positions outside of normal window dimensions. Remove code that tried to handle a subset of these situations by manual iteration of buffer text. (Bug#17777)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 16a7a64c89b..2be057fd211 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21291,6 +21291,14 @@ Value is the new character position of point. */)
21291 /* Setup the arena. */ 21291 /* Setup the arena. */
21292 SET_TEXT_POS (pt, PT, PT_BYTE); 21292 SET_TEXT_POS (pt, PT, PT_BYTE);
21293 start_display (&it, w, pt); 21293 start_display (&it, w, pt);
21294 /* When lines are truncated, we could be called with point
21295 outside of the windows edges, in which case move_it_*
21296 functions either prematurely stop at window's edge or jump to
21297 the next screen line, whereas we rely below on our ability to
21298 reach point, in order to start from its X coordinate. So we
21299 need to disregard the window's horizontal extent in that case. */
21300 if (it.line_wrap == TRUNCATE)
21301 it.last_visible_x = INFINITY;
21294 21302
21295 if (it.cmp_it.id < 0 21303 if (it.cmp_it.id < 0
21296 && it.method == GET_FROM_STRING 21304 && it.method == GET_FROM_STRING
@@ -21382,6 +21390,8 @@ Value is the new character position of point. */)
21382 if (pt_x > 0) 21390 if (pt_x > 0)
21383 { 21391 {
21384 start_display (&it, w, pt); 21392 start_display (&it, w, pt);
21393 if (it.line_wrap == TRUNCATE)
21394 it.last_visible_x = INFINITY;
21385 reseat_at_previous_visible_line_start (&it); 21395 reseat_at_previous_visible_line_start (&it);
21386 it.current_x = it.current_y = it.hpos = 0; 21396 it.current_x = it.current_y = it.hpos = 0;
21387 if (pt_vpos != 0) 21397 if (pt_vpos != 0)
@@ -21494,27 +21504,6 @@ Value is the new character position of point. */)
21494 if (it.current_x != target_x) 21504 if (it.current_x != target_x)
21495 move_it_in_display_line_to (&it, ZV, target_x, MOVE_TO_POS | MOVE_TO_X); 21505 move_it_in_display_line_to (&it, ZV, target_x, MOVE_TO_POS | MOVE_TO_X);
21496 21506
21497 /* When lines are truncated, the above loop will stop at the
21498 window edge. But we want to get to the end of line, even if
21499 it is beyond the window edge; automatic hscroll will then
21500 scroll the window to show point as appropriate. */
21501 if (target_is_eol_p && it.line_wrap == TRUNCATE
21502 && get_next_display_element (&it))
21503 {
21504 struct text_pos new_pos = it.current.pos;
21505
21506 while (!ITERATOR_AT_END_OF_LINE_P (&it))
21507 {
21508 set_iterator_to_next (&it, false);
21509 if (it.method == GET_FROM_BUFFER)
21510 new_pos = it.current.pos;
21511 if (!get_next_display_element (&it))
21512 break;
21513 }
21514
21515 it.current.pos = new_pos;
21516 }
21517
21518 /* If we ended up in a display string that covers point, move to 21507 /* If we ended up in a display string that covers point, move to
21519 buffer position to the right in the visual order. */ 21508 buffer position to the right in the visual order. */
21520 if (dir > 0) 21509 if (dir > 0)