aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2008-07-16 17:48:09 +0000
committerChong Yidong2008-07-16 17:48:09 +0000
commit8ee4117341797b62830c474838c376a3ca7d0a5e (patch)
tree167587ba169c7275901d8999c05ca4a5d658a38a /src
parent01e19fea2a251cca6bfbd281932954fa0287edd0 (diff)
downloademacs-8ee4117341797b62830c474838c376a3ca7d0a5e.tar.gz
emacs-8ee4117341797b62830c474838c376a3ca7d0a5e.zip
(move_it_in_display_line): Account for word wrap, so that we don't
move off the line.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 43cfaee767b..d7b79b527cd 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7064,7 +7064,25 @@ move_it_in_display_line (struct it *it,
7064 EMACS_INT to_charpos, int to_x, 7064 EMACS_INT to_charpos, int to_x,
7065 enum move_operation_enum op) 7065 enum move_operation_enum op)
7066{ 7066{
7067 move_it_in_display_line_to (it, to_charpos, to_x, op); 7067 if (it->line_wrap == WORD_WRAP
7068 && (op & MOVE_TO_X))
7069 {
7070 struct it save_it = *it;
7071 int skip = move_it_in_display_line_to (it, to_charpos, to_x, op);
7072 /* When word-wrap is on, TO_X may lie past the end
7073 of a wrapped line. Then it->current is the
7074 character on the next line, so backtrack to the
7075 space before the wrap point. */
7076 if (skip == MOVE_LINE_CONTINUED)
7077 {
7078 int prev_x = max (it->current_x - 1, 0);
7079 *it = save_it;
7080 move_it_in_display_line_to
7081 (it, -1, prev_x, MOVE_TO_X);
7082 }
7083 }
7084 else
7085 move_it_in_display_line_to (it, to_charpos, to_x, op);
7068} 7086}
7069 7087
7070 7088