To: vim_dev@googlegroups.com Subject: Patch 9.0.0458 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0458 Problem: Splitting a line with a text prop "above" moves it to a new line below. Solution: Keep an "above" text prop above the first line. Files: src/textprop.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_with_text_above_8.dump *** ../vim-9.0.0457/src/textprop.c 2022-09-12 19:24:31.136076277 +0100 --- src/textprop.c 2022-09-13 18:32:31.684830968 +0100 *************** *** 2264,2269 **** --- 2264,2270 ---- proptype_T *pt; int start_incl, end_incl; int cont_prev, cont_next; + int prop_col; // copy the prop to an aligned structure mch_memmove(&prop, props + i * sizeof(textprop_T), sizeof(textprop_T)); *************** *** 2271,2279 **** pt = text_prop_type_by_id(curbuf, prop.tp_type); start_incl = (pt != NULL && (pt->pt_flags & PT_FLAG_INS_START_INCL)); end_incl = (pt != NULL && (pt->pt_flags & PT_FLAG_INS_END_INCL)); ! cont_prev = prop.tp_col != MAXCOL && prop.tp_col + !start_incl <= kept; ! cont_next = prop.tp_col != MAXCOL ! && skipped <= prop.tp_col + prop.tp_len - !end_incl; // when a prop has text it is never copied if (prop.tp_id < 0 && cont_next) cont_prev = FALSE; --- 2272,2284 ---- pt = text_prop_type_by_id(curbuf, prop.tp_type); start_incl = (pt != NULL && (pt->pt_flags & PT_FLAG_INS_START_INCL)); end_incl = (pt != NULL && (pt->pt_flags & PT_FLAG_INS_END_INCL)); ! ! // a text prop "above" behaves like it is on the first text column ! prop_col = (prop.tp_flags & TP_FLAG_ALIGN_ABOVE) ? 1 : prop.tp_col; ! ! cont_prev = prop_col != MAXCOL && prop_col + !start_incl <= kept; ! cont_next = prop_col != MAXCOL ! && skipped <= prop_col + prop.tp_len - !end_incl; // when a prop has text it is never copied if (prop.tp_id < 0 && cont_next) cont_prev = FALSE; *************** *** 2292,2299 **** // Only add the property to the next line if the length is bigger than // zero. ! if ((cont_next || prop.tp_col == MAXCOL) ! && ga_grow(&nextprop, 1) == OK) { textprop_T *p = ((textprop_T *)nextprop.ga_data) + nextprop.ga_len; --- 2297,2303 ---- // Only add the property to the next line if the length is bigger than // zero. ! if ((cont_next || prop_col == MAXCOL) && ga_grow(&nextprop, 1) == OK) { textprop_T *p = ((textprop_T *)nextprop.ga_data) + nextprop.ga_len; *** ../vim-9.0.0457/src/testdir/test_textprop.vim 2022-09-12 19:24:31.136076277 +0100 --- src/testdir/test_textprop.vim 2022-09-13 18:30:26.681186449 +0100 *************** *** 2886,2891 **** --- 2886,2894 ---- call term_sendkeys(buf, "V") call VerifyScreenDump(buf, 'Test_prop_with_text_above_7', {}) + call term_sendkeys(buf, "\ls\\") + call VerifyScreenDump(buf, 'Test_prop_with_text_above_8', {}) + call StopVimInTerminal(buf) endfunc *** ../vim-9.0.0457/src/testdir/dumps/Test_prop_with_text_above_8.dump 2022-09-13 18:32:52.584772785 +0100 --- src/testdir/dumps/Test_prop_with_text_above_8.dump 2022-09-13 18:30:32.309170160 +0100 *************** *** 0 **** --- 1,9 ---- + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| @36 + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| @35 + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|i+0#0000000&|n|s|e|r|t|e|d| @45 + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| >o+0#0000000&|n|e| |t|w|o| @46 + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0&#ffffff0@48 + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|4| | +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @37 + | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000&|i|v|e| |s|i|x| @45 + @42|2|,|1| @10|A|l@1| *** ../vim-9.0.0457/src/version.c 2022-09-13 13:45:09.806461517 +0100 --- src/version.c 2022-09-13 18:32:41.820802709 +0100 *************** *** 705,706 **** --- 705,708 ---- { /* Add new patch number below this line */ + /**/ + 458, /**/ -- hundred-and-one symptoms of being an internet addict: 57. You begin to wonder how on earth your service provider is allowed to call 200 hours per month "unlimited." /// 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 ///