To: vim_dev@googlegroups.com Subject: Patch 8.0.0732 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0732 Problem: When updating a buffer for a callback the modeless selection is lost. Solution: Do not insert or delete screen lines when redrawing for a callback and there is a modeless selection. Files: src/screen.c *** ../vim-8.0.0731/src/screen.c 2017-07-16 14:04:24.974836858 +0200 --- src/screen.c 2017-07-19 12:45:34.700953773 +0200 *************** *** 112,117 **** --- 112,121 ---- static int compute_foldcolumn(win_T *wp, int col); #endif + /* Flag that is set when drawing for a callback, not from the main command + * loop. */ + static int redrawing_for_callback = 0; + /* * Buffer for one screen line (characters and attributes). */ *************** *** 445,450 **** --- 449,456 ---- void redraw_after_callback(void) { + ++redrawing_for_callback; + if (State == HITRETURN || State == ASKMORE) ; /* do nothing */ else if (State & CMDLINE) *************** *** 479,484 **** --- 485,492 ---- gui_mch_flush(); } #endif + + --redrawing_for_callback; } /* *************** *** 9742,9749 **** * - the screen has to be redrawn completely * - the line count is less than one * - the line count is more than 'ttyscroll' */ ! if (!screen_valid(TRUE) || line_count <= 0 || line_count > p_ttyscroll) return FAIL; /* --- 9750,9763 ---- * - the screen has to be redrawn completely * - the line count is less than one * - the line count is more than 'ttyscroll' + * - redrawing for a callback and there is a modeless selection */ ! if (!screen_valid(TRUE) || line_count <= 0 || line_count > p_ttyscroll ! #ifdef FEAT_CLIPBOARD ! || (clip_star.state != SELECT_CLEARED ! && redrawing_for_callback > 0) ! #endif ! ) return FAIL; /* *************** *** 9959,9967 **** * - the screen has to be redrawn completely * - the line count is less than one * - the line count is more than 'ttyscroll' */ ! if (!screen_valid(TRUE) || line_count <= 0 || ! (!force && line_count > p_ttyscroll)) return FAIL; /* --- 9973,9987 ---- * - the screen has to be redrawn completely * - the line count is less than one * - the line count is more than 'ttyscroll' + * - redrawing for a callback and there is a modeless selection */ ! if (!screen_valid(TRUE) || line_count <= 0 ! || (!force && line_count > p_ttyscroll) ! #ifdef FEAT_CLIPBOARD ! || (clip_star.state != SELECT_CLEARED ! && redrawing_for_callback > 0) ! #endif ! ) return FAIL; /* *** ../vim-8.0.0731/src/version.c 2017-07-19 11:28:10.306714031 +0200 --- src/version.c 2017-07-19 12:51:00.298576887 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 732, /**/ -- hundred-and-one symptoms of being an internet addict: 183. You move your coffeemaker next to your computer. /// 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 ///