To: vim_dev@googlegroups.com Subject: Patch 9.0.0155 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0155 Problem: Text properties with "right" and "after" alignment displayed wrong with 'nowrap'. Solution: Only start a new line for "below". Fix sorting properties. Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_with_text_after_nowrap_1.dump, src/testdir/dumps/Test_prop_with_text_after_nowrap_2.dump *** ../vim-9.0.0154/src/drawline.c 2022-08-06 15:58:48.906928830 +0100 --- src/drawline.c 2022-08-06 17:36:54.152970951 +0100 *************** *** 293,308 **** idx2 = *(int *)s2; tp1 = ¤t_text_props[idx1]; tp2 = ¤t_text_props[idx2]; - pt1 = text_prop_type_by_id(current_buf, tp1->tp_type); - pt2 = text_prop_type_by_id(current_buf, tp2->tp_type); - if (pt1 == pt2) - return 0; - if (pt1 == NULL) - return -1; - if (pt2 == NULL) - return 1; - if (pt1->pt_priority != pt2->pt_priority) - return pt1->pt_priority > pt2->pt_priority ? 1 : -1; col1 = tp1->tp_col; col2 = tp2->tp_col; if (col1 == MAXCOL && col2 == MAXCOL) --- 293,298 ---- *************** *** 322,327 **** --- 312,327 ---- if (flags1 != flags2) return flags1 < flags2 ? 1 : -1; } + pt1 = text_prop_type_by_id(current_buf, tp1->tp_type); + pt2 = text_prop_type_by_id(current_buf, tp2->tp_type); + if (pt1 == pt2) + return 0; + if (pt1 == NULL) + return -1; + if (pt2 == NULL) + return 1; + if (pt1->pt_priority != pt2->pt_priority) + return pt1->pt_priority > pt2->pt_priority ? 1 : -1; return col1 == col2 ? 0 : col1 > col2 ? 1 : -1; } #endif *************** *** 1785,1791 **** // When 'wrap' is off then for "below" we need // to start a new line explictly. ! if (!wp->w_p_wrap) { draw_screen_line(wp, &wlv); --- 1785,1792 ---- // When 'wrap' is off then for "below" we need // to start a new line explictly. ! if (below && wlv.col > win_col_off(wp) ! && !wp->w_p_wrap) { draw_screen_line(wp, &wlv); *** ../vim-9.0.0154/src/testdir/test_textprop.vim 2022-08-06 17:10:16.137025282 +0100 --- src/testdir/test_textprop.vim 2022-08-06 17:16:42.723529543 +0100 *************** *** 2434,2446 **** call setline(1, ['one', 'two', 'three']) call prop_type_add('belowprop', #{highlight: 'ErrorMsg'}) call prop_type_add('anotherprop', #{highlight: 'Search'}) call prop_add(1, 0, #{type: 'belowprop', text: ' Below the line ', text_align: 'below'}) call prop_add(2, 0, #{type: 'anotherprop', text: 'another', text_align: 'below'}) call prop_add(2, 0, #{type: 'belowprop', text: 'One More Here', text_align: 'below'}) normal G$ END call writefile(lines, 'XscriptPropsAfterNowrap') ! let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 8, cols: 60}) call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {}) call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3\") --- 2434,2449 ---- call setline(1, ['one', 'two', 'three']) call prop_type_add('belowprop', #{highlight: 'ErrorMsg'}) call prop_type_add('anotherprop', #{highlight: 'Search'}) + call prop_type_add('someprop', #{highlight: 'DiffChange'}) call prop_add(1, 0, #{type: 'belowprop', text: ' Below the line ', text_align: 'below'}) call prop_add(2, 0, #{type: 'anotherprop', text: 'another', text_align: 'below'}) call prop_add(2, 0, #{type: 'belowprop', text: 'One More Here', text_align: 'below'}) + call prop_add(1, 0, #{type: 'someprop', text: 'right here', text_align: 'right'}) + call prop_add(1, 0, #{type: 'someprop', text: ' After the text', text_align: 'after'}) normal G$ END call writefile(lines, 'XscriptPropsAfterNowrap') ! let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 10, cols: 60}) call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {}) call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3\") *** ../vim-9.0.0154/src/testdir/dumps/Test_prop_with_text_after_nowrap_1.dump 2022-08-06 13:47:16.212982332 +0100 --- src/testdir/dumps/Test_prop_with_text_after_nowrap_1.dump 2022-08-06 17:32:25.453428204 +0100 *************** *** 1,8 **** ! |o+0&#ffffff0|n|e| @56 | +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43 |t|w|o| @56 |a+0&#ffff4012|n|o|t|h|e|r| +0&#ffffff0@52 |O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| +0#0000000#ffffff0@46 |t|h|r|e>e| @54 |~+0#4040ff13&| @58 | +0#0000000&@41|3|,|5| @10|A|l@1| --- 1,10 ---- ! |o+0&#ffffff0|n|e| +0&#ffd7ff255|A|f|t|e|r| |t|h|e| |t|e|x|t| +0&#ffffff0@31|r+0&#ffd7ff255|i|g|h|t| |h|e|r|e | +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43 |t|w|o| @56 |a+0&#ffff4012|n|o|t|h|e|r| +0&#ffffff0@52 |O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| +0#0000000#ffffff0@46 |t|h|r|e>e| @54 |~+0#4040ff13&| @58 + |~| @58 + |~| @58 | +0#0000000&@41|3|,|5| @10|A|l@1| *** ../vim-9.0.0154/src/testdir/dumps/Test_prop_with_text_after_nowrap_2.dump 2022-08-06 15:58:48.906928830 +0100 --- src/testdir/dumps/Test_prop_with_text_after_nowrap_2.dump 2022-08-06 17:37:07.188949401 +0100 *************** *** 1,8 **** ! | +0#0000e05#a8a8a8255@4|o+0#0000000#ffffff0|n|e| @51 | +0#0000e05#a8a8a8255@4| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@38 | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|w|o| @51 | +0#0000e05#a8a8a8255@4|a+0#0000000#ffff4012|n|o|t|h|e|r| +0&#ffffff0@47 | +0#0000e05#a8a8a8255@4|O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| +0#0000000#ffffff0@41 | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|h|r|e>e| @49 |~+0#4040ff13&| @58 | +0#0000000&@41|3|,|5| @10|A|l@1| --- 1,10 ---- ! | +0#0000e05#a8a8a8255@4|o+0#0000000#ffffff0|n|e| +0&#ffd7ff255|A|f|t|e|r| |t|h|e| |t|e|x|t| +0&#ffffff0@26|r+0&#ffd7ff255|i|g|h|t| |h|e|r|e | +0#0000e05#a8a8a8255@4| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@38 | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|w|o| @51 | +0#0000e05#a8a8a8255@4|a+0#0000000#ffff4012|n|o|t|h|e|r| +0&#ffffff0@47 | +0#0000e05#a8a8a8255@4|O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| +0#0000000#ffffff0@41 | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|h|r|e>e| @49 |~+0#4040ff13&| @58 + |~| @58 + |~| @58 | +0#0000000&@41|3|,|5| @10|A|l@1| *** ../vim-9.0.0154/src/version.c 2022-08-06 17:10:16.141025263 +0100 --- src/version.c 2022-08-06 17:38:19.912830022 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 155, /**/ -- Place mark here ->[ ]<- if you want a dirty monitor. /// 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 ///