From 0ba54312c98bdcc8ab3ffc872cb9581710a0eea8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 30 Jun 2013 17:49:33 +0300 Subject: [PATCH] Don't call sit-for in right-char and left-char for visual cursor motion. src/xdisp.c (Fmove_point_visually): Invalidate the cursor position when moving point by using the current glyph matrix. This avoids the need to force redisplay when this function is called in a loop. lisp/bindings.el (right-char, left-char): Don't call sit-for, this is no longer needed. Use arithmetic comparison only for numerical arguments. --- lisp/ChangeLog | 4 ++++ lisp/bindings.el | 6 ++---- src/ChangeLog | 7 +++++++ src/xdisp.c | 7 +++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 283b948a2db..c9582b1c81b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2013-06-30 Eli Zaretskii + * bindings.el (right-char, left-char): Don't call sit-for, this is + no longer needed. Use arithmetic comparison only for numerical + arguments. + * international/mule-cmds.el (select-safe-coding-system): Handle the case of FROM being a string correctly. (Bug#14755) diff --git a/lisp/bindings.el b/lisp/bindings.el index a3aef3244bc..005e43b3059 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -725,8 +725,7 @@ see." (interactive "^p") (if visual-order-cursor-movement (dotimes (i (if (numberp n) (abs n) 1)) - (move-point-visually (if (< n 0) -1 1)) - (sit-for 0)) + (move-point-visually (if (and (numberp n) (< n 0)) -1 1))) (if (eq (current-bidi-paragraph-direction) 'left-to-right) (forward-char n) (backward-char n)))) @@ -744,8 +743,7 @@ see." (interactive "^p") (if visual-order-cursor-movement (dotimes (i (if (numberp n) (abs n) 1)) - (move-point-visually (if (< n 0) 1 -1)) - (sit-for 0)) + (move-point-visually (if (and (numberp n) (< n 0)) 1 -1))) (if (eq (current-bidi-paragraph-direction) 'left-to-right) (backward-char n) (forward-char n)))) diff --git a/src/ChangeLog b/src/ChangeLog index 2f1c553576f..f10e1070fa3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-06-30 Eli Zaretskii + + * xdisp.c (Fmove_point_visually): Invalidate the cursor position + when moving point by using the current glyph matrix. This avoids + the need to force redisplay when this function is called in a + loop. + 2013-06-29 Paul Eggert Fix minor problems found by static checking. diff --git a/src/xdisp.c b/src/xdisp.c index 963553e10cc..660c6b9130f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20107,6 +20107,7 @@ Value is the new character position of point. */) if (BUFFERP (g->object) && g->charpos != PT) { SET_PT (g->charpos); + w->cursor.vpos = -1; return make_number (PT); } else if (!INTEGERP (g->object) && g->object != gpt->object) @@ -20126,6 +20127,7 @@ Value is the new character position of point. */) else break; SET_PT (new_pos); + w->cursor.vpos = -1; return make_number (PT); } else if (ROW_GLYPH_NEWLINE_P (row, g)) @@ -20141,6 +20143,7 @@ Value is the new character position of point. */) SET_PT (MATRIX_ROW_END_CHARPOS (row) - 1); else break; + w->cursor.vpos = -1; return make_number (PT); } } @@ -20161,6 +20164,7 @@ Value is the new character position of point. */) if (row->reversed_p && !row->continued_p) { SET_PT (MATRIX_ROW_END_CHARPOS (row) - 1); + w->cursor.vpos = -1; return make_number (PT); } g = row->glyphs[TEXT_AREA]; @@ -20188,6 +20192,7 @@ Value is the new character position of point. */) SET_PT (ZV); else continue; + w->cursor.vpos = -1; return make_number (PT); } } @@ -20197,6 +20202,7 @@ Value is the new character position of point. */) if (!row->reversed_p && !row->continued_p) { SET_PT (MATRIX_ROW_END_CHARPOS (row) - 1); + w->cursor.vpos = -1; return make_number (PT); } e = row->glyphs[TEXT_AREA]; @@ -20224,6 +20230,7 @@ Value is the new character position of point. */) SET_PT (ZV); else continue; + w->cursor.vpos = -1; return make_number (PT); } } -- 2.11.4.GIT