To: vim_dev@googlegroups.com Subject: Patch 9.0.1482 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1482 Problem: Crash when textprop has a very large "padding" value. (Yegappan Lakshmanan) Solution: Avoid the "after" count to go negative. Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_above_padding_1.dump *** ../vim-9.0.1481/src/drawline.c 2023-04-17 21:44:32.432275197 +0100 --- src/drawline.c 2023-04-23 21:34:53.823181240 +0100 *************** *** 665,670 **** --- 665,676 ---- { before = 0; after = wp->w_width - cells - win_col_off(wp) - padding; + if (after < 0) + { + // text "above" has too much padding to fit + padding += after; + after = 0; + } } else { *** ../vim-9.0.1481/src/testdir/test_textprop.vim 2023-04-17 21:44:32.432275197 +0100 --- src/testdir/test_textprop.vim 2023-04-23 21:23:20.855309970 +0100 *************** *** 3199,3204 **** --- 3199,3224 ---- call StopVimInTerminal(buf) endfunc + func Test_prop_with_text_above_padding() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + + setlocal tabstop=8 noexpandtab + setline(1, ['', 'sky is blue', 'ocean is blue']) + prop_type_add('DiagVirtualText', {highlight: 'Search', override: true}) + prop_add(3, 0, {text: "┌─ start", text_align: "above", + type: 'DiagVirtualText', + text_padding_left: 200}) + END + call writefile(lines, 'XscriptAbovePadding', 'D') + let buf = RunVimInTerminal('-S XscriptAbovePadding', #{rows: 8}) + call VerifyScreenDump(buf, 'Test_prop_above_padding_1', {}) + + call StopVimInTerminal(buf) + endfunc + func Test_prop_above_with_indent() new call setline(1, ['first line', ' second line', ' line below']) *** ../vim-9.0.1481/src/testdir/dumps/Test_prop_above_padding_1.dump 2023-04-23 21:41:42.930683215 +0100 --- src/testdir/dumps/Test_prop_above_padding_1.dump 2023-04-23 21:32:01.403205551 +0100 *************** *** 0 **** --- 1,8 ---- + > +0&#ffffff0@74 + |s|k|y| |i|s| |b|l|u|e| @63 + @74|… + |o|c|e|a|n| |i|s| |b|l|u|e| @61 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + | +0#0000000&@56|1|,|0|-|1| @8|A|l@1| *** ../vim-9.0.1481/src/version.c 2023-04-23 17:50:14.857935970 +0100 --- src/version.c 2023-04-23 21:26:34.263263856 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1482, /**/ -- The chat program is in public domain. This is not the GNU public license. If it breaks then you get to keep both pieces. -- Copyright notice for the chat program /// 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 ///