To: vim_dev@googlegroups.com Subject: Patch 9.0.0115 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0115 Problem: When 'cmdheight' is zero pressing ':' may scroll a window. Solution: Add the made_cmdheight_nonzero flag and set 'scrolloff' to zero. Files: src/globals.h, src/window.c, src/ex_getln.c *** ../vim-9.0.0114/src/globals.h 2022-07-09 04:56:12.522528981 +0100 --- src/globals.h 2022-07-30 18:56:49.877751243 +0100 *************** *** 1728,1730 **** --- 1728,1733 ---- // While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this // overrules p_magic. Otherwise set to OPTION_MAGIC_NOT_SET. EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET); + + // Set when 'cmdheight' is changed from non-zero to one temporarily. + EXTERN int made_cmdheight_nonzero INIT(= FALSE); *** ../vim-9.0.0114/src/window.c 2022-07-30 16:54:01.867698285 +0100 --- src/window.c 2022-07-30 18:56:56.249748307 +0100 *************** *** 6365,6371 **** // There is no point in adjusting the scroll position when exiting. Some // values might be invalid. ! if (!exiting) scroll_to_fraction(wp, prev_height); } --- 6365,6372 ---- // There is no point in adjusting the scroll position when exiting. Some // values might be invalid. ! // Skip scroll_to_fraction() when 'cmdheight' was set to one from zero. ! if (!exiting && !made_cmdheight_nonzero) scroll_to_fraction(wp, prev_height); } *** ../vim-9.0.0114/src/ex_getln.c 2022-07-30 16:54:01.863698294 +0100 --- src/ex_getln.c 2022-07-30 19:09:01.353352410 +0100 *************** *** 1615,1624 **** if (cmdheight0) { ! // If cmdheight is 0, cmdheight must be set to 1 when we enter command ! // line. set_option_value((char_u *)"ch", 1L, NULL, 0); update_screen(VALID); // redraw the screen NOW } // one recursion level deeper --- 1615,1631 ---- if (cmdheight0) { ! int save_so = lastwin->w_p_so; ! ! // If cmdheight is 0, cmdheight must be set to 1 when we enter the ! // command line. Set "made_cmdheight_nonzero" and reset 'scrolloff' to ! // avoid scrolling the last window. ! made_cmdheight_nonzero = TRUE; ! lastwin->w_p_so = 0; set_option_value((char_u *)"ch", 1L, NULL, 0); update_screen(VALID); // redraw the screen NOW + made_cmdheight_nonzero = FALSE; + lastwin->w_p_so = save_so; } // one recursion level deeper *************** *** 2606,2614 **** --- 2613,2623 ---- if (cmdheight0) { + made_cmdheight_nonzero = TRUE; set_option_value((char_u *)"ch", 0L, NULL, 0); // Redraw is needed for command line completion redraw_all_later(CLEAR); + made_cmdheight_nonzero = FALSE; } --depth; *** ../vim-9.0.0114/src/version.c 2022-07-30 16:54:01.867698285 +0100 --- src/version.c 2022-07-30 18:50:59.997915152 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 115, /**/ -- hundred-and-one symptoms of being an internet addict: 200. You really believe in the concept of a "paperless" office. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///