Skip to content

Commit 702bd6c

Browse files
committed
patch 9.0.0464: with virtual text "above" indenting doesn't work well
Problem: With virtual text "above" indenting doesn't work well. Solution: Ignore text properties while adjusting indent. (issue #11084)
1 parent febe138 commit 702bd6c

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

src/charset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ init_chartabsize_arg(
954954
cts->cts_line = line;
955955
cts->cts_ptr = ptr;
956956
#ifdef FEAT_PROP_POPUP
957-
if (lnum > 0)
957+
if (lnum > 0 && !ignore_text_props)
958958
{
959959
char_u *prop_start;
960960
int count;

src/globals.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,9 @@ EXTERN int popup_visible INIT(= FALSE);
755755
EXTERN int popup_uses_mouse_move INIT(= FALSE);
756756

757757
EXTERN int text_prop_frozen INIT(= 0);
758+
759+
// when TRUE computing the cursor position ignores text properties.
760+
EXTERN int ignore_text_props INIT(= FALSE);
758761
#endif
759762

760763
// When set the popup menu will redraw soon using the pum_win_ values. Do not

src/indent.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,9 @@ change_indent(
12891289
// for the following tricks we don't want list mode
12901290
save_p_list = curwin->w_p_list;
12911291
curwin->w_p_list = FALSE;
1292+
#ifdef FEAT_PROP_POPUP
1293+
ignore_text_props = TRUE;
1294+
#endif
12921295
vc = getvcol_nolist(&curwin->w_cursor);
12931296
vcol = vc;
12941297

@@ -1440,6 +1443,9 @@ change_indent(
14401443
++start_col;
14411444
}
14421445
}
1446+
#ifdef FEAT_PROP_POPUP
1447+
ignore_text_props = FALSE;
1448+
#endif
14431449

14441450
// For MODE_VREPLACE state, we also have to fix the replace stack. In this
14451451
// case it is always possible because we backspace over the whole line and

src/testdir/test_textprop.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,6 +2892,22 @@ func Test_props_with_text_above()
28922892
call StopVimInTerminal(buf)
28932893
endfunc
28942894

2895+
func Test_prop_above_with_indent()
2896+
new
2897+
call setline(1, ['first line', ' second line', ' line below'])
2898+
setlocal cindent
2899+
call prop_type_add('indented', #{highlight: 'Search'})
2900+
call prop_add(3, 0, #{type: 'indented', text: 'here', text_align: 'above', text_padding_left: 4})
2901+
call assert_equal(' line below', getline(3))
2902+
2903+
exe "normal 3G2|a\<CR>"
2904+
call assert_equal(' ', getline(3))
2905+
call assert_equal(' line below', getline(4))
2906+
2907+
bwipe!
2908+
call prop_type_delete('indented')
2909+
endfunc
2910+
28952911
func Test_props_with_text_override()
28962912
CheckRunVimInTerminal
28972913

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ static char *(features[]) =
703703

704704
static int included_patches[] =
705705
{ /* Add new patch number below this line */
706+
/**/
707+
464,
706708
/**/
707709
463,
708710
/**/

0 commit comments

Comments
 (0)