summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-17 10:01:47 +0100
committerChristian Brabandt <cb@256bit.org>2024-03-17 10:01:47 +0100
commitf6272551bdae3f265b6948a4155b079c37fe110f (patch)
tree76dea805ec4753add4e61ad51b87b4fc323f22b9
parent8291e91c6b10e0cdeb2f29c8f1a0aad6d5b5c684 (diff)
patch 9.1.0185: 'wincolor' hl missing with 'rightleft', "below" virttext, 'nowrap'v9.1.0185
Problem: 'wincolor' highlight missing with 'rightleft', "below" virtual text and 'nowrap'. Solution: Handle 'rightleft' in draw_screen_line() (zeertzjq). closes: #14216 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/drawline.c40
-rw-r--r--src/testdir/dumps/Test_prop_wincolor_9.dump8
-rw-r--r--src/testdir/test_textprop.vim5
-rw-r--r--src/version.c2
4 files changed, 44 insertions, 11 deletions
diff --git a/src/drawline.c b/src/drawline.c
index e73d5b1b63..cc1bed6b19 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -886,6 +886,7 @@ draw_screen_line(win_T *wp, winlinevars_T *wlv)
{
#ifdef FEAT_SYN_HL
long v;
+ int wcol;
// Highlight 'cursorcolumn' & 'colorcolumn' past end of the line.
if (wp->w_p_wrap)
@@ -893,9 +894,14 @@ draw_screen_line(win_T *wp, winlinevars_T *wlv)
else
v = wp->w_leftcol;
+ wcol =
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? wp->w_width - wlv->col - 1 :
+# endif
+ wlv->col;
// check if line ends before left margin
- if (wlv->vcol < v + wlv->col - win_col_off(wp))
- wlv->vcol = v + wlv->col - win_col_off(wp);
+ if (wlv->vcol < v + wcol - win_col_off(wp))
+ wlv->vcol = v + wcol - win_col_off(wp);
# ifdef FEAT_CONCEAL
// Get rid of the boguscols now, we want to draw until the right
// edge for 'cursorcolumn'.
@@ -918,11 +924,7 @@ draw_screen_line(win_T *wp, winlinevars_T *wlv)
# ifdef LINE_ATTR
|| wlv->line_attr != 0
# endif
- || wlv->win_attr != 0)
-# ifdef FEAT_RIGHTLEFT
- && !wp->w_p_rl
-# endif
- )
+ || wlv->win_attr != 0))
{
int rightmost_vcol = 0;
int i;
@@ -935,13 +937,16 @@ draw_screen_line(win_T *wp, winlinevars_T *wlv)
if (rightmost_vcol < wlv->color_cols[i])
rightmost_vcol = wlv->color_cols[i];
- while (wlv->col < wp->w_width)
+ while (
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? (wlv->col >= 0) :
+# endif
+ (wlv->col < wp->w_width))
{
ScreenLines[wlv->off] = ' ';
if (enc_utf8)
ScreenLinesUC[wlv->off] = 0;
- ScreenCols[wlv->off] = wlv->vcol;
- ++wlv->col;
+
if (wlv->draw_color_col)
wlv->draw_color_col = advance_color_col(
VCOL_HLC, &wlv->color_cols);
@@ -956,7 +961,20 @@ draw_screen_line(win_T *wp, winlinevars_T *wlv)
attr = hl_combine_attr(attr, HL_ATTR(HLF_CUC));
else if (wlv->draw_color_col && VCOL_HLC == *wlv->color_cols)
attr = hl_combine_attr(attr, HL_ATTR(HLF_MC));
- ScreenAttrs[wlv->off++] = attr;
+ ScreenAttrs[wlv->off] = attr;
+ ScreenCols[wlv->off] = wlv->vcol;
+# ifdef FEAT_RIGHTLEFT
+ if (wp->w_p_rl)
+ {
+ --wlv->off;
+ --wlv->col;
+ }
+ else
+# endif
+ {
+ ++wlv->off;
+ ++wlv->col;
+ }
if (VCOL_HLC >= rightmost_vcol
# ifdef LINE_ATTR
diff --git a/src/testdir/dumps/Test_prop_wincolor_9.dump b/src/testdir/dumps/Test_prop_wincolor_9.dump
new file mode 100644
index 0000000000..7b26974ac3
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_wincolor_9.dump
@@ -0,0 +1,8 @@
+| +8&#af5f00255@29| +8&#ffd7d7255| +8&#af5f00255@1> @12|e|r|e|h| |t|x|e|t| |e|m|o|s
+| @51|W+8&#5fd7ff255|O|L|E|B| +8&#af5f00255@2
+| +0&#ffd7ff255@29| +0&#ffd7d7255| +0&#ffd7ff255@1| +0&#e0e0e08|e+0&#ffd7ff255|r|e|h| |t|x|e|t| |r|e|g|n|o|l| |h|c|u|m| |e|m|o|s
+| @29| +0&#ffd7d7255| +0&#ffd7ff255@1| +0&#e0e0e08| +0&#ffd7ff255@3|R+0&#ffff4012|E|T|F|A| +0&#ffd7ff255@2|e|r|e|h| |t|x|e|t| |e|r|o|m
+| +0#4040ff13&@58|~
+| @58|~
+| @58|~
+|:+0#0000000#ffffff0| @40|1|,|1|5|-|2|7| @6|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 993a64d3bb..c88b5477a1 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -4535,6 +4535,11 @@ func Test_textprop_with_wincolor()
call term_sendkeys(buf, 'k')
call VerifyScreenDump(buf, 'Test_prop_wincolor_8', {})
+ if has('rightleft')
+ call term_sendkeys(buf, ":set rightleft\<CR>:\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_wincolor_9', {})
+ endif
+
call StopVimInTerminal(buf)
endfunc
diff --git a/src/version.c b/src/version.c
index 5d768c178b..07bed4f30a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 185,
+/**/
184,
/**/
183,