]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0826: highlighting for broken terminals can be improved v9.2.0826
authorMaxim Kim <habamax@gmail.com>
Wed, 22 Jul 2026 09:16:53 +0000 (09:16 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 22 Jul 2026 09:19:43 +0000 (09:19 +0000)
Problem:  highlighting for broken terminals can be improved
          (Maxim Kim)
Solution: Make the highlighting work better when the terminal does not
          support colors (Maxim Kim)

In a colorless or broken terminal emulator current syntax highlighting
is too intense with using bold and underline for various syntax
elements.

In this scenario, when the colors are not available at all, the most
important part of the syntax is the comments, something that is not
executed or compiled.

- Comments are highlighted as bold
- All other syntax elements are set to NONE
- LineNr is not highlighted (was underline)
- SpecialKey is not highlighted (was bold)

fixes:  #20712
closes: #20799

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/version9.txt
runtime/syntax/syncolor.vim
src/highlight.c
src/version.c

index dc4f28d91c889dfff674945c7a4eb49fa46c309b..440c616a467e66fb11500995b3febeb08be0321d 100644 (file)
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.2.  Last change: 2026 Jun 26
+*version9.txt* For Vim version 9.2.  Last change: 2026 Jul 22
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -52697,6 +52697,7 @@ Changed ~
   to insert-mode mappings.
 - It is possible to clear the alternate file register |quote#|.
 - |serverlist()| can return a list of all available server names.
+- Improve visual appearance when the terminal does not support colors.
 
 
                                                        *added-9.3*
index 8b0beb88d90018d06c5f03a0b514305e12e3f6b3..28324ebe29b94128fbef8821b1f586dd42f46d48 100644 (file)
@@ -1,6 +1,6 @@
 " Vim syntax support file
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2026 Jul 22
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " This file sets up the default methods for highlighting.
@@ -33,28 +33,28 @@ endif
 " There are two sets of defaults: for a dark and a light background.
 if &background == "dark"
   SynColor Comment     term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE
-  SynColor Constant    term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE
-  SynColor Special     term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE
-  SynColor Identifier  term=underline cterm=bold ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE
-  SynColor Statement   term=bold cterm=NONE ctermfg=Yellow ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE
-  SynColor PreProc     term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE
-  SynColor Type                term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE
-  SynColor Underlined  term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff
+  SynColor Constant    term=NONE cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE
+  SynColor Special     term=NONE cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE
+  SynColor Identifier  term=NONE cterm=bold ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE
+  SynColor Statement   term=NONE cterm=NONE ctermfg=Yellow ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE
+  SynColor PreProc     term=NONE cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE
+  SynColor Type                term=NONE cterm=NONE ctermfg=LightGreen ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE
+  SynColor Underlined  term=NONE cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff
   SynColor Ignore      term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE
   SynColor Added       term=NONE cterm=NONE ctermfg=Green ctermbg=NONE gui=NONE guifg=LimeGreen guibg=NONE
   SynColor Changed     term=NONE cterm=NONE ctermfg=Blue ctermbg=NONE gui=NONE guifg=DodgerBlue guibg=NONE
   SynColor Removed     term=NONE cterm=NONE ctermfg=Red ctermbg=NONE gui=NONE guifg=Red guibg=NONE
 else
   SynColor Comment     term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=Blue guibg=NONE
-  SynColor Constant    term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Magenta guibg=NONE
+  SynColor Constant    term=NONE cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Magenta guibg=NONE
   " #6a5acd is SlateBlue
-  SynColor Special     term=bold cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a5acd guibg=NONE
-  SynColor Identifier  term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE
-  SynColor Statement   term=bold cterm=NONE ctermfg=Brown ctermbg=NONE gui=bold guifg=Brown guibg=NONE
+  SynColor Special     term=NONE cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a5acd guibg=NONE
+  SynColor Identifier  term=NONE cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE
+  SynColor Statement   term=NONE cterm=NONE ctermfg=Brown ctermbg=NONE gui=bold guifg=Brown guibg=NONE
   " #6a0dad is Purple
-  SynColor PreProc     term=underline cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a0dad guibg=NONE
-  SynColor Type                term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=bold guifg=SeaGreen guibg=NONE
-  SynColor Underlined  term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue
+  SynColor PreProc     term=NONE cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a0dad guibg=NONE
+  SynColor Type                term=NONE cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=bold guifg=SeaGreen guibg=NONE
+  SynColor Underlined  term=NONE cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue
   SynColor Ignore      term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE
   SynColor Added       term=NONE cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=SeaGreen guibg=NONE
   SynColor Changed     term=NONE cterm=NONE ctermfg=Blue ctermbg=NONE gui=NONE guifg=DodgerBlue guibg=NONE
index cfed85de336b7f38f2b0e346de40fa790314411a..efe21455f28df64b187994dadadf888de81171ab 100644 (file)
@@ -260,8 +260,8 @@ static void hl_do_font(int idx, char_u *arg, int do_normal, int do_menu, int do_
 static char *(highlight_init_both[]) = {
     CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White",
         "ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"),
-    CENT("IncSearch term=reverse cterm=reverse",
-        "IncSearch term=reverse cterm=reverse gui=reverse"),
+    CENT("IncSearch term=reverse,bold,underline cterm=reverse",
+        "IncSearch term=reverse,bold,underline cterm=reverse gui=reverse"),
     CENT("ModeMsg term=bold cterm=bold",
         "ModeMsg term=bold cterm=bold gui=bold"),
     CENT("NonText term=bold ctermfg=Blue",
@@ -326,8 +326,8 @@ static char *(highlight_init_both[]) = {
 static char *(highlight_init_light[]) = {
     CENT("Directory term=bold ctermfg=DarkBlue",
         "Directory term=bold ctermfg=DarkBlue guifg=Blue"),
-    CENT("LineNr term=underline ctermfg=Brown",
-        "LineNr term=underline ctermfg=Brown guifg=Brown"),
+    CENT("LineNr term=NONE ctermfg=Brown",
+        "LineNr term=NONE ctermfg=Brown guifg=Brown"),
     CENT("CursorLineNr term=bold cterm=underline ctermfg=Brown",
         "CursorLineNr term=bold cterm=underline ctermfg=Brown gui=bold guifg=Brown"),
     CENT("MoreMsg term=bold ctermfg=DarkGreen",
@@ -354,8 +354,8 @@ static char *(highlight_init_light[]) = {
         "Pmenu ctermbg=LightMagenta ctermfg=Black guibg=LightMagenta"),
     CENT("PmenuSel ctermbg=LightGrey ctermfg=Black",
         "PmenuSel ctermbg=LightGrey ctermfg=Black guibg=Grey"),
-    CENT("SpecialKey term=bold ctermfg=DarkBlue",
-        "SpecialKey term=bold ctermfg=DarkBlue guifg=Blue"),
+    CENT("SpecialKey term=NONE ctermfg=DarkBlue",
+        "SpecialKey term=NONE ctermfg=DarkBlue guifg=Blue"),
     CENT("Title term=bold ctermfg=DarkMagenta",
         "Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta"),
     CENT("WarningMsg term=standout ctermfg=DarkRed",
@@ -417,8 +417,8 @@ static char *(highlight_init_light[]) = {
 static char *(highlight_init_dark[]) = {
     CENT("Directory term=bold ctermfg=LightCyan",
         "Directory term=bold ctermfg=LightCyan guifg=Cyan"),
-    CENT("LineNr term=underline ctermfg=Yellow",
-        "LineNr term=underline ctermfg=Yellow guifg=Yellow"),
+    CENT("LineNr term=NONE ctermfg=Yellow",
+        "LineNr term=NONE ctermfg=Yellow guifg=Yellow"),
     CENT("CursorLineNr term=bold cterm=underline ctermfg=Yellow",
         "CursorLineNr term=bold cterm=underline ctermfg=Yellow gui=bold guifg=Yellow"),
     CENT("MoreMsg term=bold ctermfg=LightGreen",
@@ -427,8 +427,8 @@ static char *(highlight_init_dark[]) = {
         "Question term=standout ctermfg=LightGreen gui=bold guifg=Green"),
     CENT("Search term=reverse ctermbg=Yellow ctermfg=Black",
         "Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"),
-    CENT("SpecialKey term=bold ctermfg=LightBlue",
-        "SpecialKey term=bold ctermfg=LightBlue guifg=Cyan"),
+    CENT("SpecialKey term=NONE ctermfg=LightBlue",
+        "SpecialKey term=NONE ctermfg=LightBlue guifg=Cyan"),
 #ifdef FEAT_SPELL
     CENT("SpellBad term=reverse ctermbg=Red",
         "SpellBad term=reverse ctermbg=Red guisp=Red gui=undercurl"),
index 4195d04c79172bf2faecb42f24c6afd5400ba7f1..0d42fff436b51560363c390a4a436b3c72cef496 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    826,
 /**/
     825,
 /**/