To: vim_dev@googlegroups.com Subject: Patch 9.0.0464 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0464 Problem: With virtual text "above" indenting doesn't work well. Solution: Ignore text properties while adjusting indent. (issue #11084) Files: src/globals.h, src/charset.c, src/indent.c, src/testdir/test_textprop.vim *** ../vim-9.0.0463/src/globals.h 2022-08-31 14:46:07.903016994 +0100 --- src/globals.h 2022-09-14 14:59:57.019605577 +0100 *************** *** 755,760 **** --- 755,763 ---- EXTERN int popup_uses_mouse_move INIT(= FALSE); EXTERN int text_prop_frozen INIT(= 0); + + // when TRUE computing the cursor position ignores text properties. + EXTERN int ignore_text_props INIT(= FALSE); #endif // When set the popup menu will redraw soon using the pum_win_ values. Do not *** ../vim-9.0.0463/src/charset.c 2022-09-10 22:31:45.962395605 +0100 --- src/charset.c 2022-09-14 16:06:12.436987351 +0100 *************** *** 954,960 **** cts->cts_line = line; cts->cts_ptr = ptr; #ifdef FEAT_PROP_POPUP ! if (lnum > 0) { char_u *prop_start; int count; --- 954,960 ---- cts->cts_line = line; cts->cts_ptr = ptr; #ifdef FEAT_PROP_POPUP ! if (lnum > 0 && !ignore_text_props) { char_u *prop_start; int count; *** ../vim-9.0.0463/src/indent.c 2022-09-02 14:08:50.217794529 +0100 --- src/indent.c 2022-09-14 16:06:21.560957954 +0100 *************** *** 1289,1294 **** --- 1289,1297 ---- // for the following tricks we don't want list mode save_p_list = curwin->w_p_list; curwin->w_p_list = FALSE; + #ifdef FEAT_PROP_POPUP + ignore_text_props = TRUE; + #endif vc = getvcol_nolist(&curwin->w_cursor); vcol = vc; *************** *** 1440,1445 **** --- 1443,1451 ---- ++start_col; } } + #ifdef FEAT_PROP_POPUP + ignore_text_props = FALSE; + #endif // For MODE_VREPLACE state, we also have to fix the replace stack. In this // case it is always possible because we backspace over the whole line and *** ../vim-9.0.0463/src/testdir/test_textprop.vim 2022-09-13 18:34:03.144578677 +0100 --- src/testdir/test_textprop.vim 2022-09-14 16:05:50.465058752 +0100 *************** *** 2892,2897 **** --- 2892,2913 ---- call StopVimInTerminal(buf) endfunc + func Test_prop_above_with_indent() + new + call setline(1, ['first line', ' second line', ' line below']) + setlocal cindent + call prop_type_add('indented', #{highlight: 'Search'}) + call prop_add(3, 0, #{type: 'indented', text: 'here', text_align: 'above', text_padding_left: 4}) + call assert_equal(' line below', getline(3)) + + exe "normal 3G2|a\" + call assert_equal(' ', getline(3)) + call assert_equal(' line below', getline(4)) + + bwipe! + call prop_type_delete('indented') + endfunc + func Test_props_with_text_override() CheckRunVimInTerminal *** ../vim-9.0.0463/src/version.c 2022-09-14 12:51:43.397770087 +0100 --- src/version.c 2022-09-14 14:41:21.149087761 +0100 *************** *** 705,706 **** --- 705,708 ---- { /* Add new patch number below this line */ + /**/ + 464, /**/ -- hundred-and-one symptoms of being an internet addict: 70. ISDN lines are added to your house on a hourly basis /// 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 ///