To: vim_dev@googlegroups.com Subject: Patch 8.2.3122 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3122 Problem: With 'nowrap' cursor position is unexected in narrow window. (Leonid V. Fedorenchik) Solution: Put cursor on the last non-empty line. (closes #8525) Files: src/move.c, src/testdir/test_listchars.vim, src/testdir/dumps/Test_listchars_06.dump, src/testdir/dumps/Test_listchars_07.dump *** ../vim-8.2.3121/src/move.c 2021-02-10 21:10:08.934440987 +0100 --- src/move.c 2021-07-08 13:18:07.589584869 +0200 *************** *** 993,1000 **** if (textwidth <= 0) { // No room for text, put cursor in last char of window. curwin->w_wcol = curwin->w_width - 1; ! curwin->w_wrow = curwin->w_height - 1; } else if (curwin->w_p_wrap && curwin->w_width != 0) { --- 993,1004 ---- if (textwidth <= 0) { // No room for text, put cursor in last char of window. + // If not wrapping, the last non-empty line. curwin->w_wcol = curwin->w_width - 1; ! if (curwin->w_p_wrap) ! curwin->w_wrow = curwin->w_height - 1; ! else ! curwin->w_wrow = curwin->w_height - 1 - curwin->w_empty_rows; } else if (curwin->w_p_wrap && curwin->w_width != 0) { *** ../vim-8.2.3121/src/testdir/test_listchars.vim 2021-07-08 12:39:33.418516651 +0200 --- src/testdir/test_listchars.vim 2021-07-08 13:16:33.329768125 +0200 *************** *** 381,386 **** --- 381,392 ---- call VerifyScreenDump(buf, 'Test_listchars_04', {}) call term_sendkeys(buf, "\>") call VerifyScreenDump(buf, 'Test_listchars_05', {}) + call term_sendkeys(buf, "\h") + call term_sendkeys(buf, ":set nowrap foldcolumn=4\") + call term_sendkeys(buf, "15\<") + call VerifyScreenDump(buf, 'Test_listchars_06', {}) + call term_sendkeys(buf, "4\<") + call VerifyScreenDump(buf, 'Test_listchars_07', {}) " clean up call StopVimInTerminal(buf) *** ../vim-8.2.3121/src/testdir/dumps/Test_listchars_06.dump 2021-07-08 13:18:58.097486908 +0200 --- src/testdir/dumps/Test_listchars_06.dump 2021-07-08 13:16:03.549826179 +0200 *************** *** 0 **** --- 1,10 ---- + | +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @13||+1&&| +0#0000e05#a8a8a8255@4||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @26 + | +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@16||+1&&| +0#0000e05#a8a8a8255@4||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@29 + | +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @15||+1&&| +0#0000e05#a8a8a8255@4||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @28 + | +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @10||+1&&| +0#0000e05#a8a8a8255@3> ||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @23 + |~+0#4040ff13&| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31 + |~| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31 + |~| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31 + |~| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31 + |<+1#0000000&|a|m|e|]| |[|+|]| |1|,|1| @3|A|l@1| |<+3&&|]| |1|,| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @3|1|,|1| @9|A|l@1 + |:+0&&|s|e|t| |n|o|w|r|a|p| |f|o|l|d|c|o|l|u|m|n|=|4| @35 *** ../vim-8.2.3121/src/testdir/dumps/Test_listchars_07.dump 2021-07-08 13:18:58.101486902 +0200 --- src/testdir/dumps/Test_listchars_07.dump 2021-07-08 13:18:22.133556638 +0200 *************** *** 0 **** --- 1,10 ---- + | +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @13||+1&&| +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @30 + | +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@16||+1&&| +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@33 + | +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @15||+1&&| +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @32 + | +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @10||+1&&> +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @27 + |~+0#4040ff13&| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35 + |~| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35 + |~| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35 + |~| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35 + |<+1#0000000&|a|m|e|]| |[|+|]| |1|,|1| @3|A|l@1| |<+3&&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1 + |:+0&&|s|e|t| |n|o|w|r|a|p| |f|o|l|d|c|o|l|u|m|n|=|4| @35 *** ../vim-8.2.3121/src/version.c 2021-07-08 12:39:33.418516651 +0200 --- src/version.c 2021-07-08 13:13:01.226183371 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3122, /**/ -- From "know your smileys": |-( Contact lenses, but has lost them /// 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 ///