To: vim_dev@googlegroups.com Subject: Patch 8.2.3764 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3764 Problem: Cannot see any text when window was made zero lines or zero columns. Solution: Ensure there is at least one line and column. (fixes #9307) Files: src/window.c, src/proto/window.pro, src/normal.c, src/edit.c, src/testdir/test_window_cmd.vim *** ../vim-8.2.3763/src/window.c 2021-12-08 20:03:27.875867028 +0000 --- src/window.c 2021-12-09 11:03:48.118173727 +0000 *************** *** 5518,5523 **** --- 5518,5535 ---- } /* + * Make the current window show at least one line and one column. + */ + void + win_ensure_size() + { + if (curwin->w_height == 0) + win_setheight(1); + if (curwin->w_width == 0) + win_setwidth(1); + } + + /* * Set current window height and take care of repositioning other windows to * fit around it. */ *** ../vim-8.2.3763/src/proto/window.pro 2021-11-14 11:41:27.264457621 +0000 --- src/proto/window.pro 2021-12-09 11:04:33.474131339 +0000 *************** *** 55,60 **** --- 55,61 ---- void win_size_save(garray_T *gap); void win_size_restore(garray_T *gap); int win_comp_pos(void); + void win_ensure_size(void); void win_setheight(int height); void win_setheight_win(int height, win_T *win); void win_setwidth(int width); *** ../vim-8.2.3763/src/normal.c 2021-11-24 13:40:26.427007315 +0000 --- src/normal.c 2021-12-09 11:42:16.444248765 +0000 *************** *** 608,613 **** --- 608,618 ---- old_mapped_len = 0; // do go to Insert mode } + // If the window was made so small that nothing shows, make it at least one + // line and one column when typing a command. + if (KeyTyped && !KeyStuffed) + win_ensure_size(); + #ifdef FEAT_CMDL_INFO need_flushbuf = add_to_showcmd(c); #endif *** ../vim-8.2.3763/src/edit.c 2021-10-16 11:58:51.409123004 +0100 --- src/edit.c 2021-12-09 11:09:18.873893708 +0000 *************** *** 618,623 **** --- 618,628 ---- c = hkmap(c); // Hebrew mode mapping #endif + // If the window was made so small that nothing shows, make it at least + // one line and one column when typing. + if (KeyTyped && !KeyStuffed) + win_ensure_size(); + /* * Special handling of keys while the popup menu is visible or wanted * and the cursor is still in the completed word. Only when there is *** ../vim-8.2.3763/src/testdir/test_window_cmd.vim 2021-06-12 12:46:38.055854976 +0100 --- src/testdir/test_window_cmd.vim 2021-12-09 11:55:25.987637565 +0000 *************** *** 1358,1361 **** --- 1358,1395 ---- %bw! endfunc + func Test_window_minimal_size() + set winminwidth=0 winminheight=0 + + " check size is fixed vertically + new + call win_execute(win_getid(2), 'wincmd _') + call assert_equal(0, winheight(0)) + call feedkeys('0', 'tx') + call assert_equal(1, winheight(0)) + bwipe! + + " check size is fixed horizontally + vert new + call win_execute(win_getid(2), 'wincmd |') + call assert_equal(0, winwidth(0)) + call feedkeys('0', 'tx') + call assert_equal(1, winwidth(0)) + bwipe! + + if has('timers') + " check size is fixed in Insert mode + new + call timer_start(100, {_ -> win_execute(win_getid(2), 'wincmd _')}) + call timer_start(200, {_ -> assert_equal(0, winheight(0))}) + call timer_start(300, {_ -> feedkeys(" \", 't!')}) + call feedkeys('a', 'tx!') + call assert_equal(1, winheight(0)) + bwipe! + endif + + set winminwidth& winminheight& + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3763/src/version.c 2021-12-09 10:50:48.570865616 +0000 --- src/version.c 2021-12-09 11:04:24.466139637 +0000 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 3764, /**/ -- hundred-and-one symptoms of being an internet addict: 13. You refer to going to the bathroom as downloading. /// 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 ///