]> granicus.if.org Git - vim/commitdiff
patch 8.1.1606: on a narrow screen ":hi" output is confusing v8.1.1606
authorBram Moolenaar <Bram@vim.org>
Sat, 29 Jun 2019 01:42:42 +0000 (03:42 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 29 Jun 2019 01:42:42 +0000 (03:42 +0200)
Problem:    On a narrow screen ":hi" output is confusing.
Solution:   Insert a space between highlight group name and "xxx". (Masato
            Nishihaga, closes #4599)

src/syntax.c
src/testdir/test_highlight.vim
src/version.c

index 8c23d20a31526e7e952c6d68d2930e687c0f1705..4d4234683d81e0d3a053b1778b74693f1fa02bd6 100644 (file)
@@ -9440,6 +9440,7 @@ syn_list_header(
 {
     int            endcol = 19;
     int            newline = TRUE;
+    int            name_col = 0;
 
     if (!did_header)
     {
@@ -9447,6 +9448,7 @@ syn_list_header(
        if (got_int)
            return TRUE;
        msg_outtrans(HL_TABLE()[id - 1].sg_name);
+       name_col = msg_col;
        endcol = 15;
     }
     else if (msg_col + outlen + 1 >= Columns)
@@ -9471,6 +9473,8 @@ syn_list_header(
     /* Show "xxx" with the attributes. */
     if (!did_header)
     {
+       if (endcol == Columns - 1 && endcol <= name_col)
+           msg_putchar(' ');
        msg_puts_attr("xxx", syn_id2attr(id));
        msg_putchar(' ');
     }
index 09f80670f1330de70b11e88cdf179bffbfc660b0..f21ebd7e25f792a0842ee1f88f8ff3b76bc07491 100644 (file)
@@ -607,3 +607,11 @@ func Test_1_highlight_Normalgroup_exists()
     call assert_match('hi Normal\s*clear', hlNormal)
   endif
 endfunc
+
+function Test_no_space_before_xxx()
+  let l:org_columns = &columns
+  set columns=17
+  let l:hi_StatusLineTermNC = join(split(execute('hi StatusLineTermNC')))
+  call assert_match('StatusLineTermNC xxx', l:hi_StatusLineTermNC)
+  let &columns = l:org_columns
+endfunction
index 53c3c66fe129e2226a2831ffbe79ec672b715f48..aa0b8be7e3d005b39247e2369715086135cee615 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1606,
 /**/
     1605,
 /**/