To: vim_dev@googlegroups.com Subject: Patch 9.0.0784 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0784 Problem: Text prop "above" not displayed correctly with 'number' and "n" in 'cpo'. Solution: Draw the line number column until the line text is reached. Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_above_number_1.dump, src/testdir/dumps/Test_prop_above_number_2.dump *** ../vim-9.0.0783/src/drawline.c 2022-10-15 14:02:59.494610784 +0100 --- src/drawline.c 2022-10-17 18:37:22.843366615 +0100 *************** *** 343,351 **** int num_attr UNUSED) { int has_cpo_n = vim_strchr(p_cpo, CPO_NUMCOL) != NULL; if ((wp->w_p_nu || wp->w_p_rnu) ! && (wlv->row == wlv->startrow + wlv->filler_lines || !has_cpo_n) // there is no line number in a wrapped line when "n" is in // 'cpoptions', but 'breakindent' assumes it anyway. && !((has_cpo_n --- 343,356 ---- int num_attr UNUSED) { int has_cpo_n = vim_strchr(p_cpo, CPO_NUMCOL) != NULL; + int lnum_row = wlv->startrow + wlv->filler_lines + #ifdef FEAT_PROP_POPUP + + wlv->text_prop_above_count + #endif + ; if ((wp->w_p_nu || wp->w_p_rnu) ! && (wlv->row <= lnum_row || !has_cpo_n) // there is no line number in a wrapped line when "n" is in // 'cpoptions', but 'breakindent' assumes it anyway. && !((has_cpo_n *************** *** 366,375 **** // Draw the line number (empty space after wrapping). // When there are text properties above the line put the line number // below them. ! if (wlv->row == wlv->startrow + wlv->filler_lines ! #ifdef FEAT_PROP_POPUP ! + wlv->text_prop_above_count ! #endif && (wp->w_skipcol == 0 || wlv->row > wp->w_winrow || (wp->w_p_nu && wp->w_p_rnu))) { --- 371,377 ---- // Draw the line number (empty space after wrapping). // When there are text properties above the line put the line number // below them. ! if (wlv->row == lnum_row && (wp->w_skipcol == 0 || wlv->row > wp->w_winrow || (wp->w_p_nu && wp->w_p_rnu))) { *************** *** 1695,1700 **** --- 1697,1704 ---- { area_highlighting = TRUE; extra_check = TRUE; + // text props "above" move the line number down to where the + // text is. for (int i = 0; i < text_prop_count; ++i) if (text_props[i].tp_flags & TP_FLAG_ALIGN_ABOVE) ++wlv.text_prop_above_count; *** ../vim-9.0.0783/src/testdir/test_textprop.vim 2022-10-13 14:34:39.577698160 +0100 --- src/testdir/test_textprop.vim 2022-10-17 18:48:50.669419139 +0100 *************** *** 2964,2969 **** --- 2964,3000 ---- call prop_type_delete('indented') endfunc + func Test_prop_above_with_number() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + setline(1, ['one one one', 'two two two', 'three three three']) + set number cpo+=n + prop_type_add('test', {highlight: 'DiffChange'}) + prop_add(2, 0, { + text: 'above the text', + type: 'test', + text_align: 'above', + }) + def g:OneMore() + prop_add(2, 0, { + text: 'also above the text', + type: 'test', + text_align: 'above', + }) + enddef + END + call writefile(lines, 'XscriptPropAboveNr', 'D') + let buf = RunVimInTerminal('-S XscriptPropAboveNr', #{rows: 8}) + call VerifyScreenDump(buf, 'Test_prop_above_number_1', {}) + + call term_sendkeys(buf, ":call OneMore()\") + call VerifyScreenDump(buf, 'Test_prop_above_number_2', {}) + + call StopVimInTerminal(buf) + endfunc + func Test_prop_below_split_line() CheckRunVimInTerminal *** ../vim-9.0.0783/src/testdir/dumps/Test_prop_above_number_1.dump 2022-10-17 18:54:24.284649296 +0100 --- src/testdir/dumps/Test_prop_above_number_1.dump 2022-10-17 18:48:54.697409437 +0100 *************** *** 0 **** --- 1,8 ---- + | +0#af5f00255#ffffff0@1|1| >o+0#0000000&|n|e| |o|n|e| |o|n|e| @59 + | +0#af5f00255&@3|a+0#0000000#ffd7ff255|b|o|v|e| |t|h|e| |t|e|x|t| +0&#ffffff0@56 + | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |t|w|o| |t|w|o| @59 + | +0#af5f00255&@1|3| |t+0#0000000&|h|r|e@1| |t|h|r|e@1| |t|h|r|e@1| @53 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + | +0#0000000&@56|1|,|1| @10|A|l@1| *** ../vim-9.0.0783/src/testdir/dumps/Test_prop_above_number_2.dump 2022-10-17 18:54:24.288649287 +0100 --- src/testdir/dumps/Test_prop_above_number_2.dump 2022-10-17 18:48:55.853406658 +0100 *************** *** 0 **** --- 1,8 ---- + | +0#af5f00255#ffffff0@1|1| >o+0#0000000&|n|e| |o|n|e| |o|n|e| @59 + | +0#af5f00255&@3|a+0#0000000#ffd7ff255|b|o|v|e| |t|h|e| |t|e|x|t| +0&#ffffff0@56 + | +0#af5f00255&@3|a+0#0000000#ffd7ff255|l|s|o| |a|b|o|v|e| |t|h|e| |t|e|x|t| +0&#ffffff0@51 + | +0#af5f00255&@1|2| |t+0#0000000&|w|o| |t|w|o| |t|w|o| @59 + | +0#af5f00255&@1|3| |t+0#0000000&|h|r|e@1| |t|h|r|e@1| |t|h|r|e@1| @53 + |~+0#4040ff13&| @73 + |~| @73 + | +0#0000000&@56|1|,|1| @10|A|l@1| *** ../vim-9.0.0783/src/version.c 2022-10-17 18:00:13.492712191 +0100 --- src/version.c 2022-10-17 18:40:07.218827794 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 784, /**/ -- Dogs must have a permit signed by the mayor in order to congregate in groups of three or more on private property. [real standing law in Oklahoma, United States of America] /// 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 ///