To: vim_dev@googlegroups.com Subject: Patch 8.0.1574 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1574 Problem: Show cursor in wrong place when using popup menu. (Wei Zhang) Solution: Force updating the cursor position. Fix skipping over unused entries. Files: src/screen.c, src/proto/screen.pro, src/popupmnu.c *** ../vim-8.0.1573/src/screen.c 2018-03-04 18:07:04.280592270 +0100 --- src/screen.c 2018-03-06 11:24:27.946250978 +0100 *************** *** 9471,9477 **** void setcursor(void) { ! if (redrawing()) { validate_cursor(); windgoto(W_WINROW(curwin) + curwin->w_wrow, --- 9471,9487 ---- void setcursor(void) { ! setcursor_mayforce(FALSE); ! } ! ! /* ! * Set cursor to its position in the current window. ! * When "force" is TRUE also when not redrawing. ! */ ! void ! setcursor_mayforce(int force) ! { ! if (force || redrawing()) { validate_cursor(); windgoto(W_WINROW(curwin) + curwin->w_wrow, *** ../vim-8.0.1573/src/proto/screen.pro 2017-09-13 22:11:31.761200612 +0200 --- src/proto/screen.pro 2018-03-06 11:25:34.393856094 +0100 *************** *** 44,49 **** --- 44,50 ---- void screen_start(void); void windgoto(int row, int col); void setcursor(void); + void setcursor_mayforce(int force); int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear); int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear, int clear_attr); int screen_ins_lines(int off, int row, int line_count, int end, int clear_attr, win_T *wp); *** ../vim-8.0.1573/src/popupmnu.c 2018-03-05 21:06:19.763252514 +0100 --- src/popupmnu.c 2018-03-06 11:31:53.835600769 +0100 *************** *** 1104,1117 **** * Execute the currently selected popup menu item. */ static void ! pum_execute_menu(vimmenu_T *menu) { vimmenu_T *mp; int idx = 0; exarg_T ea; for (mp = menu->children; mp != NULL; mp = mp->next) ! if (idx++ == pum_selected) { vim_memset(&ea, 0, sizeof(ea)); execute_menu(&ea, mp); --- 1104,1117 ---- * Execute the currently selected popup menu item. */ static void ! pum_execute_menu(vimmenu_T *menu, int mode) { vimmenu_T *mp; int idx = 0; exarg_T ea; for (mp = menu->children; mp != NULL; mp = mp->next) ! if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected) { vim_memset(&ea, 0, sizeof(ea)); execute_menu(&ea, mp); *************** *** 1171,1177 **** int c; pum_redraw(); ! setcursor(); out_flush(); c = vgetc(); --- 1171,1177 ---- int c; pum_redraw(); ! setcursor_mayforce(TRUE); out_flush(); c = vgetc(); *************** *** 1180,1186 **** else if (c == CAR || c == NL) { /* enter: select current item, if any, and close */ ! pum_execute_menu(menu); break; } else if (c == 'k' || c == K_UP || c == K_MOUSEUP) --- 1180,1186 ---- else if (c == CAR || c == NL) { /* enter: select current item, if any, and close */ ! pum_execute_menu(menu, mode); break; } else if (c == 'k' || c == K_UP || c == K_MOUSEUP) *************** *** 1221,1227 **** pum_select_mouse_pos(); if (pum_selected >= 0) { ! pum_execute_menu(menu); break; } if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM) --- 1221,1227 ---- pum_select_mouse_pos(); if (pum_selected >= 0) { ! pum_execute_menu(menu, mode); break; } if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM) *** ../vim-8.0.1573/src/version.c 2018-03-05 22:43:05.523985559 +0100 --- src/version.c 2018-03-06 11:25:17.845954436 +0100 *************** *** 768,769 **** --- 768,771 ---- { /* Add new patch number below this line */ + /**/ + 1574, /**/ -- OLD WOMAN: Well, how did you become king, then? ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite, held Excalibur aloft from the bosom of the water to signify by Divine Providence ... that I, Arthur, was to carry Excalibur ... That is why I am your king! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///