To: vim_dev@googlegroups.com Subject: Patch 9.0.1305 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1305 Problem: Cursor in wrong line with virtual text above. Solution: Count extra line for text property above/below. (closes #11959) Files: src/structs.h, src/charset.c, src/testdir/dumps/Test_prop_above_empty_1.dump *** ../vim-9.0.1304/src/structs.h 2023-01-28 15:19:36.960757169 +0000 --- src/structs.h 2023-02-12 17:52:18.381718255 +0000 *************** *** 4781,4786 **** --- 4781,4787 ---- textprop_T *cts_text_props; // text props (allocated) char cts_has_prop_with_text; // TRUE if if a property inserts text int cts_cur_text_width; // width of current inserted text + int cts_prop_lines; // nr of properties above or below int cts_first_char; // width text props above the line int cts_with_trailing; // include size of trailing props with // last character *** ../vim-9.0.1304/src/charset.c 2023-02-11 13:48:40.334694239 +0000 --- src/charset.c 2023-02-12 17:55:53.093998088 +0000 *************** *** 813,818 **** --- 813,823 ---- { (void)win_lbr_chartabsize(cts, NULL); cts->cts_vcol += cts->cts_cur_text_width; + + // when properties are above or below the empty line must also be + // counted + if (cts->cts_prop_lines > 0) + ++cts->cts_vcol; } #endif } *************** *** 1217,1222 **** --- 1222,1231 ---- tab_size = win_chartabsize(wp, s, vcol + size); size += tab_size; } + if (tp->tp_col == MAXCOL && (tp->tp_flags + & (TP_FLAG_ALIGN_ABOVE | TP_FLAG_ALIGN_BELOW))) + // count extra line for property above/below + ++cts->cts_prop_lines; } } if (tp->tp_col != MAXCOL && tp->tp_col - 1 > col) *** ../vim-9.0.1304/src/testdir/dumps/Test_prop_above_empty_1.dump 2023-02-12 18:01:25.230249331 +0000 --- src/testdir/dumps/Test_prop_above_empty_1.dump 2023-02-12 17:59:43.090189184 +0000 *************** *** 0 **** --- 1,16 ---- + | +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 + | +0#af5f00255&@1|1| |1+0#0000000&@7| @47 + | +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 + | +0#af5f00255&@1|2| | +0#0000000&@55 + | +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 + | +0#af5f00255&@1|3| |3+0#0000000&@8| @46 + | +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 + | +0#af5f00255&@1|4| | +0#0000000&@55 + | +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 + | +0#af5f00255&@1|5| >5+0#0000000&@10| @44 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |~| @58 + |~| @58 + | +0#0000000&@41|5|,|1|-|5|7| @7|A|l@1| *** ../vim-9.0.1304/src/version.c 2023-02-12 14:41:58.064650999 +0000 --- src/version.c 2023-02-12 17:51:38.605651800 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1305, /**/ -- An actual excerpt from a classified section of a city newspaper: "Illiterate? Write today for free help!" /// 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 ///