Skip to content

Commit 6b9c202

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Problem: "below" virtual text doesn't work with 'rightleft'. Solution: Use column from right border with 'rightleft'. closes: #13071 Signed-off-by: Christian Brabandt <[email protected]> Co-authored-by: zeertzjq <[email protected]>
1 parent 4d00b83 commit 6b9c202

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

src/drawline.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,10 +2011,8 @@ win_line(
20112011

20122012
if (wlv.n_extra == 0 ||
20132013
(!wlv.extra_for_textprop
2014-
#ifdef FEAT_PROP_POPUP
20152014
&& !(text_prop_type != NULL &&
20162015
text_prop_flags & PT_FLAG_OVERRIDE)
2017-
#endif
20182016
))
20192017
{
20202018
text_prop_attr = 0;
@@ -2134,15 +2132,15 @@ win_line(
21342132
if (*ptr == NUL)
21352133
// don't combine char attr after EOL
21362134
text_prop_flags &= ~PT_FLAG_COMBINE;
2137-
#ifdef FEAT_LINEBREAK
2135+
# ifdef FEAT_LINEBREAK
21382136
if (above || below || right || !wrap)
21392137
{
21402138
// no 'showbreak' before "below" text property
21412139
// or after "above" or "right" text property
21422140
wlv.need_showbreak = FALSE;
21432141
wlv.dont_use_showbreak = TRUE;
21442142
}
2145-
#endif
2143+
# endif
21462144
if ((right || above || below || !wrap
21472145
|| padding > 0) && wp->w_width > 2)
21482146
{
@@ -2155,6 +2153,11 @@ win_line(
21552153
// exactly the same.
21562154
start_line = text_prop_position(wp, tp,
21572155
wlv.vcol,
2156+
# ifdef FEAT_RIGHTLEFT
2157+
wp->w_p_rl
2158+
? wp->w_width - wlv.col - 1
2159+
:
2160+
# endif
21582161
wlv.col,
21592162
&wlv.n_extra, &wlv.p_extra,
21602163
&n_attr, &wlv.n_attr_skip,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| +0&#ffffff0@50|e|d|c|b>a| +0#af5f00255&|1| @1
2+
| +0#0000000&@50|5+0#e000e06&|4|3|2|1| +0#af5f00255&@3
3+
| +0#4040ff13&@58|~
4+
| @58|~
5+
| @58|~
6+
| +0#0000000&@41|1|,|1| @10|A|l@1|

src/testdir/test_textprop.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,6 +3087,23 @@ func Test_prop_with_multibyte_below()
30873087
call StopVimInTerminal(buf)
30883088
endfunc
30893089

3090+
func Test_prop_with_text_below_rightleft()
3091+
CheckRunVimInTerminal
3092+
CheckFeature rightleft
3093+
3094+
let lines =<< trim END
3095+
setlocal number rightleft
3096+
call setline(1, 'abcde')
3097+
call prop_type_add('theprop', #{highlight: 'Special'})
3098+
call prop_add(1, 0, #{type: 'theprop', text: '12345', text_align: 'below'})
3099+
END
3100+
call writefile(lines, 'XscriptPropBelowRightleft', 'D')
3101+
let buf = RunVimInTerminal('-S XscriptPropBelowRightleft', #{rows: 6, cols: 60})
3102+
call VerifyScreenDump(buf, 'Test_prop_below_rightleft_1', {})
3103+
3104+
call StopVimInTerminal(buf)
3105+
endfunc
3106+
30903107
func Test_prop_with_text_above_empty()
30913108
CheckRunVimInTerminal
30923109

src/version.c

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

700700
static int included_patches[] =
701701
{ /* Add new patch number below this line */
702+
/**/
703+
1896,
702704
/**/
703705
1895,
704706
/**/

0 commit comments

Comments
 (0)