To: vim_dev@googlegroups.com Subject: Patch 8.2.4718 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4718 Problem: @@@ in the last line sometimes drawn in the wrong place. Solution: Make sure the column is valid. (closes #10130) Files: src/drawscreen.c, src/screen.c, src/testdir/test_display.vim src/testdir/dumps/Test_display_lastline_1.dump, src/testdir/dumps/Test_display_lastline_2.dump, src/testdir/dumps/Test_display_lastline_3.dump, src/testdir/dumps/Test_display_lastline_4.dump *** ../vim-8.2.4717/src/drawscreen.c 2022-03-29 11:38:13.639070607 +0100 --- src/drawscreen.c 2022-04-09 12:39:19.071994991 +0100 *************** *** 2617,2624 **** int scr_row = W_WINROW(wp) + wp->w_height - 1; // Last line isn't finished: Display "@@@" in the last screen line. ! screen_puts_len((char_u *)"@@", 2, scr_row, wp->w_wincol, ! HL_ATTR(HLF_AT)); screen_fill(scr_row, scr_row + 1, (int)wp->w_wincol + 2, (int)W_ENDCOL(wp), '@', ' ', HL_ATTR(HLF_AT)); --- 2617,2624 ---- int scr_row = W_WINROW(wp) + wp->w_height - 1; // Last line isn't finished: Display "@@@" in the last screen line. ! screen_puts_len((char_u *)"@@", wp->w_width > 2 ? 2 : wp->w_width, ! scr_row, wp->w_wincol, HL_ATTR(HLF_AT)); screen_fill(scr_row, scr_row + 1, (int)wp->w_wincol + 2, (int)W_ENDCOL(wp), '@', ' ', HL_ATTR(HLF_AT)); *************** *** 2627,2636 **** } else if (dy_flags & DY_LASTLINE) // 'display' has "lastline" { // Last line isn't finished: Display "@@@" at the end. screen_fill(W_WINROW(wp) + wp->w_height - 1, W_WINROW(wp) + wp->w_height, ! (int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp), '@', '@', HL_ATTR(HLF_AT)); set_empty_rows(wp, srow); wp->w_botline = lnum; --- 2627,2639 ---- } else if (dy_flags & DY_LASTLINE) // 'display' has "lastline" { + int start_col = (int)W_ENDCOL(wp) - 3; + // Last line isn't finished: Display "@@@" at the end. screen_fill(W_WINROW(wp) + wp->w_height - 1, W_WINROW(wp) + wp->w_height, ! start_col < wp->w_wincol ? wp->w_wincol : start_col, ! (int)W_ENDCOL(wp), '@', '@', HL_ATTR(HLF_AT)); set_empty_rows(wp, srow); wp->w_botline = lnum; *** ../vim-8.2.4717/src/screen.c 2022-04-03 13:23:18.982779936 +0100 --- src/screen.c 2022-04-09 12:16:18.153773203 +0100 *************** *** 2331,2339 **** } /* ! * Fill the screen from 'start_row' to 'end_row', from 'start_col' to 'end_col' ! * with character 'c1' in first column followed by 'c2' in the other columns. ! * Use attributes 'attr'. */ void screen_fill( --- 2331,2339 ---- } /* ! * Fill the screen from "start_row" to "end_row" (exclusive), from "start_col" ! * to "end_col" (exclusive) with character "c1" in first column followed by ! * "c2" in the other columns. Use attributes "attr". */ void screen_fill( *** ../vim-8.2.4717/src/testdir/test_display.vim 2022-03-25 15:42:07.311639049 +0000 --- src/testdir/test_display.vim 2022-04-09 12:33:17.004401461 +0100 *************** *** 372,376 **** --- 372,402 ---- let &breakat=_breakat endfunc + func Test_display_lastline() + CheckScreendump + + let lines =<< trim END + call setline(1, ['aaa', 'b'->repeat(100)]) + set display=truncate + vsplit + 100wincmd < + END + call writefile(lines, 'XdispLastline') + let buf = RunVimInTerminal('-S XdispLastline', #{rows: 10}) + call VerifyScreenDump(buf, 'Test_display_lastline_1', {}) + + call term_sendkeys(buf, ":set display=lastline\") + call VerifyScreenDump(buf, 'Test_display_lastline_2', {}) + + call term_sendkeys(buf, ":100wincmd >\") + call VerifyScreenDump(buf, 'Test_display_lastline_3', {}) + + call term_sendkeys(buf, ":set display=truncate\") + call VerifyScreenDump(buf, 'Test_display_lastline_4', {}) + + call StopVimInTerminal(buf) + call delete('XdispLastline') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4717/src/testdir/dumps/Test_display_lastline_1.dump 2022-04-09 12:38:31.640050511 +0100 --- src/testdir/dumps/Test_display_lastline_1.dump 2022-04-09 12:33:44.548372244 +0100 *************** *** 0 **** --- 1,10 ---- + >a+0&#ffffff0||+1&&|a+0&&@2| @69 + |a||+1&&|b+0&&@72 + |a||+1&&|b+0&&@26| @45 + |b||+1&&|~+0#4040ff13&| @71 + |b+0#0000000&||+1&&|~+0#4040ff13&| @71 + |b+0#0000000&||+1&&|~+0#4040ff13&| @71 + |b+0#0000000&||+1&&|~+0#4040ff13&| @71 + |@||+1#0000000&|~+0#4040ff13&| @71 + |<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1 + | +0&&@74 *** ../vim-8.2.4717/src/testdir/dumps/Test_display_lastline_2.dump 2022-04-09 12:38:31.644050506 +0100 --- src/testdir/dumps/Test_display_lastline_2.dump 2022-04-09 12:33:45.700371014 +0100 *************** *** 0 **** --- 1,10 ---- + >a+0&#ffffff0||+1&&|a+0&&@2| @69 + |a||+1&&|b+0&&@72 + |a||+1&&|b+0&&@26| @45 + |b||+1&&|~+0#4040ff13&| @71 + |b+0#0000000&||+1&&|~+0#4040ff13&| @71 + |b+0#0000000&||+1&&|~+0#4040ff13&| @71 + |b+0#0000000&||+1&&|~+0#4040ff13&| @71 + |@||+1#0000000&|~+0#4040ff13&| @71 + |<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1 + |:+0&&|s|e|t| |d|i|s|p|l|a|y|=|l|a|s|t|l|i|n|e| @53 *** ../vim-8.2.4717/src/testdir/dumps/Test_display_lastline_3.dump 2022-04-09 12:38:31.648050500 +0100 --- src/testdir/dumps/Test_display_lastline_3.dump 2022-04-09 12:33:46.856369779 +0100 *************** *** 0 **** --- 1,10 ---- + >a+0&#ffffff0@2| @69||+1&&|a+0&& + |b@72||+1&&|a+0&& + |b@26| @45||+1&&|a+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|@+0#4040ff13& + |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1| |<+1&& + |:+0&&|1|0@1|w|i|n|c|m|d| |>| @62 *** ../vim-8.2.4717/src/testdir/dumps/Test_display_lastline_4.dump 2022-04-09 12:38:31.652050497 +0100 --- src/testdir/dumps/Test_display_lastline_4.dump 2022-04-09 12:33:48.012368542 +0100 *************** *** 0 **** --- 1,10 ---- + >a+0&#ffffff0@2| @69||+1&&|a+0&& + |b@72||+1&&|a+0&& + |b@26| @45||+1&&|a+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|b+0&& + |~+0#4040ff13&| @71||+1#0000000&|@+0#4040ff13& + |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1| |<+1&& + |:+0&&|s|e|t| |d|i|s|p|l|a|y|=|t|r|u|n|c|a|t|e| @53 *** ../vim-8.2.4717/src/version.c 2022-04-09 11:37:08.196325535 +0100 --- src/version.c 2022-04-09 12:25:39.020840376 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4718, /**/ -- How come wrong numbers are never busy? /// 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 ///