Skip to content

Commit 548be7f

Browse files
committed
patch 8.1.1606: on a narrow screen ":hi" output is confusing
Problem: On a narrow screen ":hi" output is confusing. Solution: Insert a space between highlight group name and "xxx". (Masato Nishihaga, closes #4599)
1 parent 4340fc9 commit 548be7f

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/syntax.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9440,13 +9440,15 @@ syn_list_header(
94409440
{
94419441
int endcol = 19;
94429442
int newline = TRUE;
9443+
int name_col = 0;
94439444

94449445
if (!did_header)
94459446
{
94469447
msg_putchar('\n');
94479448
if (got_int)
94489449
return TRUE;
94499450
msg_outtrans(HL_TABLE()[id - 1].sg_name);
9451+
name_col = msg_col;
94509452
endcol = 15;
94519453
}
94529454
else if (msg_col + outlen + 1 >= Columns)
@@ -9471,6 +9473,8 @@ syn_list_header(
94719473
/* Show "xxx" with the attributes. */
94729474
if (!did_header)
94739475
{
9476+
if (endcol == Columns - 1 && endcol <= name_col)
9477+
msg_putchar(' ');
94749478
msg_puts_attr("xxx", syn_id2attr(id));
94759479
msg_putchar(' ');
94769480
}

src/testdir/test_highlight.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,3 +607,11 @@ func Test_1_highlight_Normalgroup_exists()
607607
call assert_match('hi Normal\s*clear', hlNormal)
608608
endif
609609
endfunc
610+
611+
function Test_no_space_before_xxx()
612+
let l:org_columns = &columns
613+
set columns=17
614+
let l:hi_StatusLineTermNC = join(split(execute('hi StatusLineTermNC')))
615+
call assert_match('StatusLineTermNC xxx', l:hi_StatusLineTermNC)
616+
let &columns = l:org_columns
617+
endfunction

src/version.c

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

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1606,
780782
/**/
781783
1605,
782784
/**/

0 commit comments

Comments
 (0)