aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-06-04 12:16:46 +0300
committerEli Zaretskii2014-06-04 12:16:46 +0300
commitd13adf6ddc858a988f88233fe6d73a8ca4a87cf7 (patch)
treef7ded9b13a8785e0c643bb3cd6a7cd893bfede25 /src/term.c
parent4a52a98a9a5a49719da0a44d5ab1ddfde9a2aedc (diff)
downloademacs-d13adf6ddc858a988f88233fe6d73a8ca4a87cf7.tar.gz
emacs-d13adf6ddc858a988f88233fe6d73a8ca4a87cf7.zip
Attempt to solve bug #17497 by minimizing cursor motion during TTY menu updates.
src/term.c (tty_menu_display): Don't position cursor here. Instead, pass the cursor coordinates to update_frame_with_menu. (tty_menu_activate): Send the hide cursor command only once in an iteration through the outer 'while' loop. src/dispnew.c (update_frame_1): Accept an additional argument SET_CURSOR_P, and position the cursor at the end of the frame update only if that argument is non-zero. All callers changed to provide the additional argument as non-zero, except for update_frame_with_menu. (update_frame_with_menu): Accept 2 additional arguments ROW and COL; if they are non-negative, instruct update_frame_1 not to position the cursor, and instead position it according to ROW and COL. src/dispextern.h (update_frame_with_menu): Update prototype.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/term.c b/src/term.c
index 12cd2ce8508..8661cba1160 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2907,8 +2907,7 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces,
2907 display_tty_menu_item (menu->text[j], max_width, face, x, y + i, 2907 display_tty_menu_item (menu->text[j], max_width, face, x, y + i,
2908 menu->submenu[j] != NULL); 2908 menu->submenu[j] != NULL);
2909 } 2909 }
2910 update_frame_with_menu (sf); 2910 update_frame_with_menu (sf, row, col);
2911 cursor_to (sf, row, col);
2912} 2911}
2913 2912
2914/* --------------------------- X Menu emulation ---------------------- */ 2913/* --------------------------- X Menu emulation ---------------------- */
@@ -3079,7 +3078,7 @@ static void
3079screen_update (struct frame *f, struct glyph_matrix *mtx) 3078screen_update (struct frame *f, struct glyph_matrix *mtx)
3080{ 3079{
3081 restore_desired_matrix (f, mtx); 3080 restore_desired_matrix (f, mtx);
3082 update_frame_with_menu (f); 3081 update_frame_with_menu (f, -1, -1);
3083} 3082}
3084 3083
3085typedef enum { 3084typedef enum {
@@ -3228,7 +3227,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3228 3227
3229 /* Force update of the current frame, so that the desired and the 3228 /* Force update of the current frame, so that the desired and the
3230 current matrices are identical. */ 3229 current matrices are identical. */
3231 update_frame_with_menu (sf); 3230 update_frame_with_menu (sf, -1, -1);
3232 state[0].menu = menu; 3231 state[0].menu = menu;
3233 state[0].screen_behind = save_and_enable_current_matrix (sf); 3232 state[0].screen_behind = save_and_enable_current_matrix (sf);
3234 3233
@@ -3373,8 +3372,6 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3373 state[statecount - 1].y, 3372 state[statecount - 1].y,
3374 state[statecount - 1].pane, 3373 state[statecount - 1].pane,
3375 faces, x, y, first_item, 1); 3374 faces, x, y, first_item, 1);
3376 tty_hide_cursor (tty);
3377 fflush (tty->output);
3378 /* The call to display help-echo below will move the cursor, 3375 /* The call to display help-echo below will move the cursor,
3379 so remember its current position as computed by 3376 so remember its current position as computed by
3380 tty_menu_display. */ 3377 tty_menu_display. */
@@ -3393,10 +3390,13 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3393 item, so that screen readers and other accessibility aids 3390 item, so that screen readers and other accessibility aids
3394 know where the active region is. */ 3391 know where the active region is. */
3395 cursor_to (sf, row, col); 3392 cursor_to (sf, row, col);
3396 tty_hide_cursor (tty);
3397 fflush (tty->output);
3398 prev_menu_help_message = menu_help_message; 3393 prev_menu_help_message = menu_help_message;
3399 } 3394 }
3395 /* Both tty_menu_display and help_callback invoke update_end,
3396 which calls tty_show_cursor. Re-hide it, so it doesn't show
3397 through the menus. */
3398 tty_hide_cursor (tty);
3399 fflush (tty->output);
3400 } 3400 }
3401 3401
3402 sf->mouse_moved = 0; 3402 sf->mouse_moved = 0;