feat(highlight): update default color scheme

Problem: Default color scheme is suboptimal.

Solution: Start using new color scheme. Introduce new `vim` color scheme
for opt-in backward compatibility.

------
Main design ideas
- Be "Neovim branded".
- Be minimal for 256 colors with a bit more shades for true colors.
- Be accessible through high enough contrast ratios.
- Be suitable for dark and light backgrounds via exchange of dark and
  light palettes.

------
Palettes

- Have dark and light variants. Implemented through exporeted
  `NvimDark*` and `NvimLight*` hex colors.

- Palettes have 4 shades of grey for UI elements and 6 colors (red,
  yellow, green, cyan, blue, magenta).

- Actual values are computed procedurally in Oklch color space based on
  a handful of hyperparameters.

- Each color has a 256 colors variant with perceptually closest color.

------
Highlight groups

Use:

- Grey shades for general UI according to their design.

- Bold text for keywords (`Statement` highlight group). This is an
  important choice to increase accessibility for people with color
  deficiencies, as it doesn't rely on actual color.

- Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some
  minor text UI elements.

- Cyan as main syntax color, i.e. for function usage (`Function`
  highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI
  elements.

- Red to generally mean high user attention, i.e. errors; in particular
  for `ErrorMsg`, `DiffDelete`, `DiagnosticError`.

- Yellow very sparingly only with true colors to mean mild user
  attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`.

- Blue very sparingly only with true colors as `DiagnosticHint` and some
  additional important syntax group (like `Identifier`).

- Magenta very carefully (if at all).

------
Notes

- To make tests work without relatively larege updates, each one is
  prepended with an equivalent of the call `:colorscheme vim`.

  Plus some tests which spawn new Neovim instances also now use 'vim'
  color scheme.

  In some cases tests are updated to fit new default color scheme.
This commit is contained in:
Evgeni Chasnovski 2023-11-29 22:16:09 +02:00
parent 17f3a3ae31
commit 64a14026d7
No known key found for this signature in database
GPG Key ID: BB32E27DDF942DFB
24 changed files with 1149 additions and 623 deletions

View File

@ -1,12 +1,10 @@
" Vim color file " Neovim color file
" Maintainer: The Vim Project <https://github.com/vim/vim> " Maintainer: The Neovim Project <https://github.com/neovim/neovim>
" Last Change: 2023 Aug 10 " Last Change: 2023 Dec 01
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" This is the default color scheme. It doesn't define the Normal " This is the default color scheme.
" highlighting, it uses whatever the colors used to be.
" Set 'background' back to the default. The value can't always be estimated " Set 'background' back to the default. The value can't always be estimated
" and is then guessed. " and is then guessed.
hi clear Normal hi clear Normal
set bg& set bg&

269
runtime/colors/vim.vim Normal file
View File

@ -0,0 +1,269 @@
" Name: vim
" Description: Vim's default color scheme
" Author: Bram Moolenaar <Bram@vim.org>
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Website: https://github.com/vim/vim
" License: Same as Vim
" Last Updated: 2023 Aug 10
" This is Vim's default color scheme. It doesn't define the Normal
" highlighting, it uses whatever the colors used to be.
hi clear
let g:colors_name = 'vim'
" General
hi Conceal guifg=LightGrey guibg=DarkGrey guisp=NONE gui=NONE ctermfg=LightGrey ctermbg=DarkGrey cterm=NONE
hi Cursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=bg ctermbg=fg cterm=NONE
hi lCursor guifg=bg guibg=fg guisp=NONE gui=NONE ctermfg=bg ctermbg=fg cterm=NONE
hi DiffText guifg=NONE guibg=Red guisp=NONE gui=bold ctermfg=NONE ctermbg=Red cterm=bold
hi ErrorMsg guifg=White guibg=Red guisp=NONE gui=NONE ctermfg=White ctermbg=DarkRed cterm=NONE
hi IncSearch guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi ModeMsg guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi NonText guifg=Blue guibg=NONE guisp=NONE gui=bold ctermfg=Blue ctermbg=NONE cterm=NONE
hi Normal guifg=NONE guibg=NONE guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=Grey guisp=NONE gui=NONE ctermfg=NONE ctermbg=Grey cterm=NONE
hi StatusLine guifg=NONE guibg=NONE guisp=NONE gui=reverse,bold ctermfg=NONE ctermbg=NONE cterm=reverse,bold
hi StatusLineNC guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineFill guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi TermCursor guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi WinBar guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi WildMenu guifg=Black guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE
hi! link VertSplit Normal
hi! link WinSeparator VertSplit
hi! link WinBarNC WinBar
hi! link EndOfBuffer NonText
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
hi! link QuickFixLine Search
hi! link CursorLineSign SignColumn
hi! link CursorLineFold FoldColumn
hi! link CurSearch Search
hi! link PmenuKind Pmenu
hi! link PmenuKindSel PmenuSel
hi! link PmenuExtra Pmenu
hi! link PmenuExtraSel PmenuSel
hi! link Substitute Search
hi! link Whitespace NonText
hi! link MsgSeparator StatusLine
hi! link NormalFloat Pmenu
hi! link FloatBorder WinSeparator
hi! link FloatTitle Title
hi! link FloatFooter Title
hi FloatShadow guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE blend=80
hi FloatShadowThrough guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE blend=100
hi RedrawDebugNormal guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi RedrawDebugClear guifg=NONE guibg=Yellow guisp=NONE gui=NONE ctermfg=NONE ctermbg=Yellow cterm=NONE
hi RedrawDebugComposed guifg=NONE guibg=Green guisp=NONE gui=NONE ctermfg=NONE ctermbg=Green cterm=NONE
hi RedrawDebugRecompose guifg=NONE guibg=Red guisp=NONE gui=NONE ctermfg=NONE ctermbg=Red cterm=NONE
hi Error guifg=White guibg=Red guisp=NONE gui=NONE ctermfg=White ctermbg=Red cterm=NONE term=reverse
hi Todo guifg=Blue guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE term=standout
hi! link String Constant
hi! link Character Constant
hi! link Number Constant
hi! link Boolean Constant
hi! link Float Number
hi! link Function Identifier
hi! link Conditional Statement
hi! link Repeat Statement
hi! link Label Statement
hi! link Operator Statement
hi! link Keyword Statement
hi! link Exception Statement
hi! link Include PreProc
hi! link Define PreProc
hi! link Macro PreProc
hi! link PreCondit PreProc
hi! link StorageClass Type
hi! link Structure Type
hi! link Typedef Type
hi! link Tag Special
hi! link SpecialChar Special
hi! link Delimiter Special
hi! link SpecialComment Special
hi! link Debug Special
hi DiagnosticError guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=1 ctermbg=NONE cterm=NONE
hi DiagnosticWarn guifg=Orange guibg=NONE guisp=NONE gui=NONE ctermfg=3 ctermbg=NONE cterm=NONE
hi DiagnosticInfo guifg=LightBlue guibg=NONE guisp=NONE gui=NONE ctermfg=4 ctermbg=NONE cterm=NONE
hi DiagnosticHint guifg=LightGrey guibg=NONE guisp=NONE gui=NONE ctermfg=7 ctermbg=NONE cterm=NONE
hi DiagnosticOk guifg=LightGreen guibg=NONE guisp=NONE gui=NONE ctermfg=10 ctermbg=NONE cterm=NONE
hi DiagnosticUnderlineError guifg=NONE guibg=NONE guisp=Red gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi DiagnosticUnderlineWarn guifg=NONE guibg=NONE guisp=Orange gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi DiagnosticUnderlineInfo guifg=NONE guibg=NONE guisp=LightBlue gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi DiagnosticUnderlineHint guifg=NONE guibg=NONE guisp=LightGrey gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi DiagnosticUnderlineOk guifg=NONE guibg=NONE guisp=LightGreen gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi! link DiagnosticVirtualTextError DiagnosticError
hi! link DiagnosticVirtualTextWarn DiagnosticWarn
hi! link DiagnosticVirtualTextInfo DiagnosticInfo
hi! link DiagnosticVirtualTextHint DiagnosticHint
hi! link DiagnosticVirtualTextOk DiagnosticOk
hi! link DiagnosticFloatingError DiagnosticError
hi! link DiagnosticFloatingWarn DiagnosticWarn
hi! link DiagnosticFloatingInfo DiagnosticInfo
hi! link DiagnosticFloatingHint DiagnosticHint
hi! link DiagnosticFloatingOk DiagnosticOk
hi! link DiagnosticSignError DiagnosticError
hi! link DiagnosticSignWarn DiagnosticWarn
hi! link DiagnosticSignInfo DiagnosticInfo
hi! link DiagnosticSignHint DiagnosticHint
hi! link DiagnosticSignOk DiagnosticOk
hi DiagnosticDeprecated guifg=NONE guibg=NONE guisp=Red gui=strikethrough ctermfg=NONE ctermbg=NONE cterm=strikethrough
hi! link DiagnosticUnnecessary Comment
hi! link LspInlayHint NonText
hi! link SnippetTabstop Visual
" Text
hi! link @text.literal Comment
hi! link @text.reference Identifier
hi! link @text.title Title
hi! link @text.uri Underlined
hi! link @text.underline Underlined
hi! link @text.todo Todo
" Miscs
hi! link @comment Comment
hi! link @punctuation Delimiter
" Constants
hi! link @constant Constant
hi! link @constant.builtin Special
hi! link @constant.macro Define
hi! link @define Define
hi! link @macro Macro
hi! link @string String
hi! link @string.escape SpecialChar
hi! link @string.special SpecialChar
hi! link @character Character
hi! link @character.special SpecialChar
hi! link @number Number
hi! link @boolean Boolean
hi! link @float Float
" Functions
hi! link @function Function
hi! link @function.builtin Special
hi! link @function.macro Macro
hi! link @parameter Identifier
hi! link @method Function
hi! link @field Identifier
hi! link @property Identifier
hi! link @constructor Special
" Keywords
hi! link @conditional Conditional
hi! link @repeat Repeat
hi! link @label Label
hi! link @operator Operator
hi! link @keyword Keyword
hi! link @exception Exception
hi! link @variable Identifier
hi! link @type Type
hi! link @type.definition Typedef
hi! link @storageclass StorageClass
hi! link @namespace Identifier
hi! link @include Include
hi! link @preproc PreProc
hi! link @debug Debug
hi! link @tag Tag
" LSP semantic tokens
hi! link @lsp.type.class Structure
hi! link @lsp.type.comment Comment
hi! link @lsp.type.decorator Function
hi! link @lsp.type.enum Structure
hi! link @lsp.type.enumMember Constant
hi! link @lsp.type.function Function
hi! link @lsp.type.interface Structure
hi! link @lsp.type.macro Macro
hi! link @lsp.type.method Function
hi! link @lsp.type.namespace Structure
hi! link @lsp.type.parameter Identifier
hi! link @lsp.type.property Identifier
hi! link @lsp.type.struct Structure
hi! link @lsp.type.type Type
hi! link @lsp.type.typeParameter TypeDef
hi! link @lsp.type.variable Identifier
if &background ==# 'light'
" Default colors only used with a light background.
hi ColorColumn guifg=NONE guibg=LightRed guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightRed cterm=NONE
hi CursorColumn guifg=NONE guibg=Grey90 guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightGrey cterm=NONE
hi CursorLine guifg=NONE guibg=Grey90 guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorLineNr guifg=Brown guibg=NONE guisp=NONE gui=bold ctermfg=Brown ctermbg=NONE cterm=underline
hi DiffAdd guifg=NONE guibg=LightBlue guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightBlue cterm=NONE
hi DiffChange guifg=NONE guibg=LightMagenta guisp=NONE gui=NONE ctermfg=NONE ctermbg=LightMagenta cterm=NONE
hi DiffDelete guifg=Blue guibg=LightCyan guisp=NONE gui=bold ctermfg=Blue ctermbg=LightCyan cterm=NONE
hi Directory guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE
hi FoldColumn guifg=DarkBlue guibg=Grey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE
hi Folded guifg=DarkBlue guibg=LightGrey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE
hi LineNr guifg=Brown guibg=NONE guisp=NONE gui=NONE ctermfg=Brown ctermbg=NONE cterm=NONE
hi MatchParen guifg=NONE guibg=Cyan guisp=NONE gui=NONE ctermfg=NONE ctermbg=Cyan cterm=NONE
hi MoreMsg guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE
hi Pmenu guifg=NONE guibg=LightMagenta guisp=NONE gui=NONE ctermfg=Black ctermbg=LightMagenta cterm=NONE
hi PmenuSel guifg=NONE guibg=Grey guisp=NONE gui=NONE ctermfg=Black ctermbg=LightGrey cterm=NONE blend=NONE
hi PmenuThumb guifg=NONE guibg=Black guisp=NONE gui=NONE ctermfg=NONE ctermbg=Black cterm=NONE
hi Question guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE
hi Search guifg=NONE guibg=Yellow guisp=NONE gui=NONE ctermfg=NONE ctermbg=Yellow cterm=NONE
hi SignColumn guifg=DarkBlue guibg=Grey guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=Grey cterm=NONE
hi SpecialKey guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE
hi SpellBad guifg=NONE guibg=NONE guisp=Red gui=undercurl ctermfg=NONE ctermbg=LightRed cterm=NONE
hi SpellCap guifg=NONE guibg=NONE guisp=Blue gui=undercurl ctermfg=NONE ctermbg=LightBlue cterm=NONE
hi SpellLocal guifg=NONE guibg=NONE guisp=DarkCyan gui=undercurl ctermfg=NONE ctermbg=Cyan cterm=NONE
hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=LightMagenta cterm=NONE
hi TabLine guifg=NONE guibg=LightGrey guisp=NONE gui=underline ctermfg=black ctermbg=LightGrey cterm=underline
hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=DarkMagenta ctermbg=NONE cterm=NONE
hi Visual guifg=NONE guibg=LightGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE
hi Comment guifg=Blue guibg=NONE guisp=NONE gui=NONE ctermfg=DarkBlue ctermbg=NONE cterm=NONE term=bold
hi Constant guifg=Magenta guibg=NONE guisp=NONE gui=NONE ctermfg=DarkRed ctermbg=NONE cterm=NONE term=underline
hi Special guifg=#6a5acd guibg=NONE guisp=NONE gui=NONE ctermfg=DarkMagenta ctermbg=NONE cterm=NONE term=bold
hi Identifier guifg=DarkCyan guibg=NONE guisp=NONE gui=NONE ctermfg=DarkCyan ctermbg=NONE cterm=NONE term=underline
hi Statement guifg=Brown guibg=NONE guisp=NONE gui=bold ctermfg=Brown ctermbg=NONE cterm=NONE term=bold
hi PreProc guifg=#6a0dad guibg=NONE guisp=NONE gui=NONE ctermfg=DarkMagenta ctermbg=NONE cterm=NONE term=underline
hi Type guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=DarkGreen ctermbg=NONE cterm=NONE term=underline
hi Underlined guifg=SlateBlue guibg=NONE guisp=NONE gui=underline ctermfg=DarkMagenta ctermbg=NONE cterm=underline term=underline
hi Ignore guifg=bg guibg=NONE guisp=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE term=NONE
else
" Default colors only used with a dark background.
hi ColorColumn guifg=NONE guibg=DarkRed guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkRed cterm=NONE
hi CursorColumn guifg=NONE guibg=Grey40 guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkGrey cterm=NONE
hi CursorLine guifg=NONE guibg=Grey40 guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorLineNr guifg=Yellow guibg=NONE guisp=NONE gui=bold ctermfg=Yellow ctermbg=NONE cterm=underline
hi DiffAdd guifg=NONE guibg=DarkBlue guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkBlue cterm=NONE
hi DiffChange guifg=NONE guibg=DarkMagenta guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkMagenta cterm=NONE
hi DiffDelete guifg=Blue guibg=DarkCyan guisp=NONE gui=bold ctermfg=Blue ctermbg=DarkCyan cterm=NONE
hi Directory guifg=Cyan guibg=NONE guisp=NONE gui=NONE ctermfg=LightCyan ctermbg=NONE cterm=NONE
hi FoldColumn guifg=Cyan guibg=Grey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE
hi Folded guifg=Cyan guibg=DarkGrey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE
hi LineNr guifg=Yellow guibg=NONE guisp=NONE gui=NONE ctermfg=Yellow ctermbg=NONE cterm=NONE
hi MatchParen guifg=NONE guibg=DarkCyan guisp=NONE gui=NONE ctermfg=NONE ctermbg=DarkCyan cterm=NONE
hi MoreMsg guifg=SeaGreen guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE
hi Pmenu guifg=NONE guibg=Magenta guisp=NONE gui=NONE ctermfg=Black ctermbg=Magenta cterm=NONE
hi PmenuSel guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=DarkGrey ctermbg=Black cterm=NONE blend=NONE
hi PmenuThumb guifg=NONE guibg=White guisp=NONE gui=NONE ctermfg=NONE ctermbg=White cterm=NONE
hi Question guifg=Green guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE
hi Search guifg=Black guibg=Yellow guisp=NONE gui=NONE ctermfg=Black ctermbg=Yellow cterm=NONE
hi SignColumn guifg=Cyan guibg=Grey guisp=NONE gui=NONE ctermfg=Cyan ctermbg=DarkGrey cterm=NONE
hi SpecialKey guifg=Cyan guibg=NONE guisp=NONE gui=NONE ctermfg=LightBlue ctermbg=NONE cterm=NONE
hi SpellBad guifg=NONE guibg=NONE guisp=Red gui=undercurl ctermfg=NONE ctermbg=Red cterm=NONE
hi SpellCap guifg=NONE guibg=NONE guisp=Blue gui=undercurl ctermfg=NONE ctermbg=Blue cterm=NONE
hi SpellLocal guifg=NONE guibg=NONE guisp=Cyan gui=undercurl ctermfg=NONE ctermbg=Cyan cterm=NONE
hi SpellRare guifg=NONE guibg=NONE guisp=Magenta gui=undercurl ctermfg=NONE ctermbg=Magenta cterm=NONE
hi TabLine guifg=NONE guibg=DarkGrey guisp=NONE gui=underline ctermfg=white ctermbg=DarkGrey cterm=underline
hi Title guifg=Magenta guibg=NONE guisp=NONE gui=bold ctermfg=LightMagenta ctermbg=NONE cterm=NONE
hi Visual guifg=NONE guibg=DarkGrey guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi WarningMsg guifg=Red guibg=NONE guisp=NONE gui=NONE ctermfg=LightRed ctermbg=NONE cterm=NONE
hi Comment guifg=#80a0ff guibg=NONE guisp=NONE gui=NONE ctermfg=Cyan ctermbg=NONE cterm=NONE term=bold
hi Constant guifg=#ffa0a0 guibg=NONE guisp=NONE gui=NONE ctermfg=Magenta ctermbg=NONE cterm=NONE term=underline
hi Special guifg=Orange guibg=NONE guisp=NONE gui=NONE ctermfg=LightRed ctermbg=NONE cterm=NONE term=bold
hi Identifier guifg=#40ffff guibg=NONE guisp=NONE gui=NONE ctermfg=Cyan ctermbg=NONE cterm=bold term=underline
hi Statement guifg=#ffff60 guibg=NONE guisp=NONE gui=bold ctermfg=Yellow ctermbg=NONE cterm=NONE term=bold
hi PreProc guifg=#ff80ff guibg=NONE guisp=NONE gui=NONE ctermfg=LightBlue ctermbg=NONE cterm=NONE term=underline
hi Type guifg=#60ff60 guibg=NONE guisp=NONE gui=bold ctermfg=LightGreen ctermbg=NONE cterm=NONE term=underline
hi Underlined guifg=#80a0ff guibg=NONE guisp=NONE gui=underline ctermfg=LightBlue ctermbg=NONE cterm=underline term=underline
hi Ignore guifg=bg guibg=NONE guisp=NONE gui=NONE ctermfg=black ctermbg=NONE cterm=NONE term=NONE
endif
" vim: sw=2

103
runtime/doc/dev_theme.txt Normal file
View File

@ -0,0 +1,103 @@
*dev_theme.txt* Nvim
NVIM REFERENCE MANUAL
Nvim theme style guide *dev-theme*
This is style guide for developers working on Nvim's default color scheme.
License: CC-By 3.0 https://creativecommons.org/licenses/by/3.0/
Type |gO| to see the table of contents.
==============================================================================
Design
- Be "Neovim branded", i.e. have mostly "green-blue" feel plus one or two
colors reserved for very occasional user attention.
- Be extra minimal for 'notermguicolors' (256 colors) while allowing a bit
more shades when 'termguicolors' is set (true colors).
- Be accessible, i.e. have high enough contrast ratio (as defined in
https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef).
This means to have value at least 7 for |hl-Normal| and 4.5 for some common
cases (|hl-Visual|, `Comment` with set 'cursorline', colored syntax, `Diff*`,
|hl-Search|).
- Be suitable for dark and light backgrounds via exchange of dark and light
palettes.
- Be usable, i.e. provide enough visual feedback for common objects.
==============================================================================
Palettes
- There are two separate palettes: dark and light. They all contain the same
set of colors exported as `NvimDark*` and `NvimLight*` colors respectively.
- The dark palette is used for background in the dark color scheme and for
foreground in the light color scheme; and vice versa. This introduces
recognizable visual system without too standing out.
- Actual computation of palettes should be done in a perceptually uniform
color space. Oklch is a good choice.
- Each palette has the following colors (descriptions are for dark background;
reverse for light one):
- Four shades of "colored" greys for general UI. In 256 colors they are
exact greys; in true colors they are shades of "cold" grey.
- Dark ones (from darkest to lightest) are reserved as background for
|hl-NormalFloat| (considered as "black"), |hl-Normal| (background),
|hl-CursorLine|, |hl-Visual|.
- Light ones (also from darkest to lightest) are reserved for
`Comment`, |hl-StatusLine|/|hl-TabLine|, |hl-Normal| (foreground),
and color considered as "white".
- Six colors to provide enough terminal colors: red, yellow, green, cyan,
blue, magenta.
They should have (reasonably) similar lightness and chroma to make them
visually coherent. Lightness should be as equal to the palette's basic grey
(which is used for |hl-Normal|) as possible. They should have (reasonably)
different hues to make them visually separable.
- Each palette color should have a 256 colors variant with closest color
computed based on the perceptually uniform distance measure.
==============================================================================
Highlight groups
Use:
- Grey shades for general UI according to their design.
- Bold text for keywords (`Statement` highlight group). This is an important
choice to increase accessibility for people with color deficiencies, as it
doesn't rely on actual color.
- Green for strings, |hl-DiffAdd| (as background), |hl-DiagnosticOk|, and some
minor text UI elements.
- Cyan as main syntax color, i.e. for function usage (`Function` highlight
group), |hl-DiffText|, |hl-DiagnosticInfo|, and some minor text UI elements.
- Red to generally mean high user attention, i.e. errors; in particular for
|hl-ErrorMsg|, |hl-DiffDelete|, |hl-DiagnosticError|.
- Yellow very sparingly only with true colors to mean mild user attention,
i.e. warnings. That is, |hl-DiagnosticWarn| and |hl-WarningMsg|.
- Blue very sparingly only with true colors as |hl-DiagnosticHint| and some
additional important syntax group (like `Identifier`).
- Magenta very carefully (if at all).
vim:tw=78:ts=8:et:ft=help:norl:

View File

@ -95,6 +95,9 @@ The following changes may require adaptations in user config or plugins.
• Legacy and extmark signs are displayed and listed with the same priority: • Legacy and extmark signs are displayed and listed with the same priority:
line number -> priority -> sign id -> recently placed line number -> priority -> sign id -> recently placed
• Default color scheme has been updated to be "Neovim branded" and accessible.
Use `:colorscheme vim` to revert to the old legacy color scheme.
============================================================================== ==============================================================================
BREAKING CHANGES IN HEAD *news-breaking-dev* BREAKING CHANGES IN HEAD *news-breaking-dev*

View File

@ -30,6 +30,8 @@ Defaults *nvim-defaults*
":filetype off" to |init.vim|. ":filetype off" to |init.vim|.
- Syntax highlighting is enabled by default. This can be disabled by adding - Syntax highlighting is enabled by default. This can be disabled by adding
":syntax off" to |init.vim|. ":syntax off" to |init.vim|.
- Default color scheme has been updated. This can be reversed by adding
":colorscheme vim" to |init.vim|.
- 'autoindent' is enabled - 'autoindent' is enabled
- 'autoread' is enabled (works in all UIs, including terminal) - 'autoread' is enabled (works in all UIs, including terminal)

View File

@ -135,263 +135,321 @@ static const char e_missing_argument_str[]
// they still work when the runtime files can't be found. // they still work when the runtime files can't be found.
static const char *highlight_init_both[] = { static const char *highlight_init_both[] = {
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey", "Cursor guibg=fg guifg=bg",
"Cursor guibg=fg guifg=bg", "CursorLineNr gui=bold cterm=bold",
"lCursor guibg=fg guifg=bg", "QuickFixLine gui=bold cterm=bold",
"DiffText cterm=bold ctermbg=Red gui=bold guibg=Red", "RedrawDebugNormal gui=reverse cterm=reverse",
"ErrorMsg ctermbg=DarkRed ctermfg=White guibg=Red guifg=White", "TabLineSel gui=bold cterm=bold",
"IncSearch cterm=reverse gui=reverse", "TermCursor gui=reverse cterm=reverse",
"ModeMsg cterm=bold gui=bold", "Title gui=bold cterm=bold",
"NonText ctermfg=Blue gui=bold guifg=Blue", "Underlined gui=underline cterm=underline",
"Normal cterm=NONE gui=NONE", "lCursor guibg=fg guifg=bg",
"PmenuSbar ctermbg=Grey guibg=Grey",
"StatusLine cterm=reverse,bold gui=reverse,bold", // UI
"StatusLineNC cterm=reverse gui=reverse", "default link CurSearch Search",
"TabLineFill cterm=reverse gui=reverse", "default link CursorIM Cursor",
"TabLineSel cterm=bold gui=bold",
"TermCursor cterm=reverse gui=reverse",
"WinBar cterm=bold gui=bold",
"WildMenu ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black",
"default link VertSplit Normal",
"default link WinSeparator VertSplit",
"default link WinBarNC WinBar",
"default link EndOfBuffer NonText",
"default link LineNrAbove LineNr",
"default link LineNrBelow LineNr",
"default link QuickFixLine Search",
"default link CursorLineSign SignColumn",
"default link CursorLineFold FoldColumn", "default link CursorLineFold FoldColumn",
"default link CurSearch Search", "default link CursorLineSign SignColumn",
"default link PmenuKind Pmenu", "default link EndOfBuffer NonText",
"default link PmenuKindSel PmenuSel", "default link FloatBorder NormalFloat",
"default link PmenuExtra Pmenu", "default link FloatFooter Title",
"default link PmenuExtraSel PmenuSel", "default link FloatTitle Title",
"default link Substitute Search", "default link FoldColumn SignColumn",
"default link Whitespace NonText", "default link IncSearch Search",
"default link MsgSeparator StatusLine", "default link LineNrAbove LineNr",
"default link NormalFloat Pmenu", "default link LineNrBelow LineNr",
"default link FloatBorder WinSeparator", "default link MsgSeparator StatusLine",
"default link FloatTitle Title", "default link MsgArea NONE",
"default link FloatFooter Title", "default link NormalNC NONE",
"default FloatShadow blend=80 guibg=Black", "default link PmenuExtra Pmenu",
"default FloatShadowThrough blend=100 guibg=Black", "default link PmenuExtraSel PmenuSel",
"RedrawDebugNormal cterm=reverse gui=reverse", "default link PmenuKind Pmenu",
"RedrawDebugClear ctermbg=Yellow guibg=Yellow", "default link PmenuKindSel PmenuSel",
"RedrawDebugComposed ctermbg=Green guibg=Green", "default link PmenuSbar Pmenu",
"RedrawDebugRecompose ctermbg=Red guibg=Red", "default link Substitute Search",
"Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red", "default link TabLineFill TabLine",
"Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow", "default link TermCursorNC NONE",
"default link String Constant", "default link VertSplit WinSeparator",
"default link Character Constant", "default link VisualNOS Visual",
"default link Number Constant", "default link Whitespace NonText",
"default link Boolean Constant", "default link WildMenu PmenuSel",
"default link Float Number", "default link WinBar StatusLine",
"default link Function Identifier", "default link WinBarNC StatusLineNC",
"default link Conditional Statement", "default link WinSeparator Normal",
"default link Repeat Statement",
"default link Label Statement", // Syntax
"default link Operator Statement", "default link Character Constant",
"default link Keyword Statement", "default link Number Constant",
"default link Exception Statement", "default link Boolean Constant",
"default link Include PreProc", "default link Float Number",
"default link Define PreProc", "default link Conditional Statement",
"default link Macro PreProc", "default link Repeat Statement",
"default link PreCondit PreProc", "default link Label Statement",
"default link StorageClass Type", "default link Keyword Statement",
"default link Structure Type", "default link Exception Statement",
"default link Typedef Type", "default link Include PreProc",
"default link Tag Special", "default link Define PreProc",
"default link SpecialChar Special", "default link Macro PreProc",
"default link Delimiter Special", "default link PreCondit PreProc",
"default link StorageClass Type",
"default link Structure Type",
"default link Typedef Type",
"default link Tag Special",
"default link SpecialChar Special",
"default link SpecialComment Special", "default link SpecialComment Special",
"default link Debug Special", "default link Debug Special",
"default DiagnosticError ctermfg=1 guifg=Red", "default link Ignore Normal",
"default DiagnosticWarn ctermfg=3 guifg=Orange", "default link LspInlayHint NonText",
"default DiagnosticInfo ctermfg=4 guifg=LightBlue",
"default DiagnosticHint ctermfg=7 guifg=LightGrey",
"default DiagnosticOk ctermfg=10 guifg=LightGreen",
"default DiagnosticUnderlineError cterm=underline gui=underline guisp=Red",
"default DiagnosticUnderlineWarn cterm=underline gui=underline guisp=Orange",
"default DiagnosticUnderlineInfo cterm=underline gui=underline guisp=LightBlue",
"default DiagnosticUnderlineHint cterm=underline gui=underline guisp=LightGrey",
"default DiagnosticUnderlineOk cterm=underline gui=underline guisp=LightGreen",
"default link DiagnosticVirtualTextError DiagnosticError",
"default link DiagnosticVirtualTextWarn DiagnosticWarn",
"default link DiagnosticVirtualTextInfo DiagnosticInfo",
"default link DiagnosticVirtualTextHint DiagnosticHint",
"default link DiagnosticVirtualTextOk DiagnosticOk",
"default link DiagnosticFloatingError DiagnosticError",
"default link DiagnosticFloatingWarn DiagnosticWarn",
"default link DiagnosticFloatingInfo DiagnosticInfo",
"default link DiagnosticFloatingHint DiagnosticHint",
"default link DiagnosticFloatingOk DiagnosticOk",
"default link DiagnosticSignError DiagnosticError",
"default link DiagnosticSignWarn DiagnosticWarn",
"default link DiagnosticSignInfo DiagnosticInfo",
"default link DiagnosticSignHint DiagnosticHint",
"default link DiagnosticSignOk DiagnosticOk",
"default DiagnosticDeprecated cterm=strikethrough gui=strikethrough guisp=Red",
"default link DiagnosticUnnecessary Comment",
"default link LspInlayHint NonText",
"default link SnippetTabstop Visual", "default link SnippetTabstop Visual",
// Diagnostic
"default link DiagnosticVirtualTextError DiagnosticError",
"default link DiagnosticVirtualTextWarn DiagnosticWarn",
"default link DiagnosticVirtualTextInfo DiagnosticInfo",
"default link DiagnosticVirtualTextHint DiagnosticHint",
"default link DiagnosticVirtualTextOk DiagnosticOk",
"default link DiagnosticSignError DiagnosticError",
"default link DiagnosticSignWarn DiagnosticWarn",
"default link DiagnosticSignInfo DiagnosticInfo",
"default link DiagnosticSignHint DiagnosticHint",
"default link DiagnosticSignOk DiagnosticOk",
"default link DiagnosticUnnecessary Comment",
// Text // Text
"default link @text.literal Comment", "default link @text.literal Comment",
"default link @text.reference Identifier", "default link @text.reference Identifier",
"default link @text.title Title", "default link @text.title Title",
"default link @text.uri Underlined", "default link @text.uri Underlined",
"default link @text.underline Underlined", "default link @text.underline Underlined",
"default link @text.todo Todo", "default link @text.todo Todo",
// Miscs // Miscs
"default link @comment Comment", "default link @comment Comment",
"default link @punctuation Delimiter", "default link @punctuation Delimiter",
// Constants // Constants
"default link @constant Constant", "default link @constant Constant",
"default link @constant.builtin Special", "default link @constant.builtin Special",
"default link @constant.macro Define", "default link @constant.macro Define",
"default link @define Define", "default link @define Define",
"default link @macro Macro", "default link @macro Macro",
"default link @string String", "default link @string String",
"default link @string.escape SpecialChar", "default link @string.escape SpecialChar",
"default link @string.special SpecialChar", "default link @string.special SpecialChar",
"default link @character Character", "default link @character Character",
"default link @character.special SpecialChar", "default link @character.special SpecialChar",
"default link @number Number", "default link @number Number",
"default link @boolean Boolean", "default link @boolean Boolean",
"default link @float Float", "default link @float Float",
// Functions // Functions
"default link @function Function", "default link @function Function",
"default link @function.builtin Special", "default link @function.builtin Special",
"default link @function.macro Macro", "default link @function.macro Macro",
"default link @parameter Identifier", "default link @parameter Identifier",
"default link @method Function", "default link @method Function",
"default link @field Identifier", "default link @field Identifier",
"default link @property Identifier", "default link @property Identifier",
"default link @constructor Special", "default link @constructor Special",
// Keywords // Keywords
"default link @conditional Conditional", "default link @conditional Conditional",
"default link @repeat Repeat", "default link @repeat Repeat",
"default link @label Label", "default link @label Label",
"default link @operator Operator", "default link @operator Operator",
"default link @keyword Keyword", "default link @keyword Keyword",
"default link @exception Exception", "default link @exception Exception",
"default link @variable Identifier", "default link @variable NONE", // don't highlight to reduce visual overload
"default link @type Type", "default link @type Type",
"default link @type.definition Typedef", "default link @type.definition Typedef",
"default link @storageclass StorageClass", "default link @storageclass StorageClass",
"default link @namespace Identifier", "default link @namespace Identifier",
"default link @include Include", "default link @include Include",
"default link @preproc PreProc", "default link @preproc PreProc",
"default link @debug Debug", "default link @debug Debug",
"default link @tag Tag", "default link @tag Tag",
// LSP semantic tokens // LSP semantic tokens
"default link @lsp.type.class Structure", "default link @lsp.type.class Structure",
"default link @lsp.type.comment Comment", "default link @lsp.type.comment Comment",
"default link @lsp.type.decorator Function", "default link @lsp.type.decorator Function",
"default link @lsp.type.enum Structure", "default link @lsp.type.enum Structure",
"default link @lsp.type.enumMember Constant", "default link @lsp.type.enumMember Constant",
"default link @lsp.type.function Function", "default link @lsp.type.function Function",
"default link @lsp.type.interface Structure", "default link @lsp.type.interface Structure",
"default link @lsp.type.macro Macro", "default link @lsp.type.macro Macro",
"default link @lsp.type.method Function", "default link @lsp.type.method Function",
"default link @lsp.type.namespace Structure", "default link @lsp.type.namespace Structure",
"default link @lsp.type.parameter Identifier", "default link @lsp.type.parameter Identifier",
"default link @lsp.type.property Identifier", "default link @lsp.type.property Identifier",
"default link @lsp.type.struct Structure", "default link @lsp.type.struct Structure",
"default link @lsp.type.type Type", "default link @lsp.type.type Type",
"default link @lsp.type.typeParameter TypeDef", "default link @lsp.type.typeParameter TypeDef",
"default link @lsp.type.variable Identifier", "default link @lsp.type.variable NONE", // don't highlight to reduce visual overload
NULL NULL
}; };
// Default colors only used with a light background. // Default colors only used with a light background.
static const char *highlight_init_light[] = { static const char *highlight_init_light[] = {
"ColorColumn ctermbg=LightRed guibg=LightRed", "Normal guifg=NvimDarkGrey2 ctermfg=234 guibg=NvimLightGrey2 ctermbg=253",
"CursorColumn ctermbg=LightGrey guibg=Grey90",
"CursorLine cterm=underline guibg=Grey90", // UI
"CursorLineNr cterm=underline ctermfg=Brown gui=bold guifg=Brown", "ColorColumn guibg=NvimLightGrey4 ctermbg=247",
"DiffAdd ctermbg=LightBlue guibg=LightBlue", "Conceal guifg=NvimLightGrey4 ctermfg=247",
"DiffChange ctermbg=LightMagenta guibg=LightMagenta", "CursorColumn guibg=NvimLightGrey3 ctermbg=251",
"DiffDelete ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan", "CursorLine guibg=NvimLightGrey3 ctermbg=251",
"Directory ctermfg=DarkBlue guifg=Blue", "DiffAdd guifg=NvimDarkGrey1 ctermfg=232 guibg=NvimLightGreen ctermbg=158",
"FoldColumn ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue", "DiffChange guifg=NvimDarkGrey1 ctermfg=232 guibg=NvimLightGrey4 ctermbg=247",
"Folded ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue", "DiffDelete guifg=NvimDarkRed ctermfg=52 gui=bold cterm=bold",
"LineNr ctermfg=Brown guifg=Brown", "DiffText guifg=NvimDarkGrey1 ctermfg=232 guibg=NvimLightCyan ctermbg=123",
"MatchParen ctermbg=Cyan guibg=Cyan", "Directory guifg=NvimDarkCyan ctermfg=30",
"MoreMsg ctermfg=DarkGreen gui=bold guifg=SeaGreen", "ErrorMsg guifg=NvimDarkRed ctermfg=52",
"Pmenu ctermbg=LightMagenta ctermfg=Black guibg=LightMagenta", "FloatShadow guibg=NvimLightGrey1 ctermbg=255 blend=80",
"PmenuSel ctermbg=LightGrey ctermfg=Black guibg=Grey", "FloatShadowThrough guibg=NvimLightGrey1 ctermbg=255 blend=100",
"PmenuThumb ctermbg=Black guibg=Black", "Folded guifg=NvimDarkGrey4 ctermfg=239 guibg=NvimLightGrey3 ctermbg=251",
"Question ctermfg=DarkGreen gui=bold guifg=SeaGreen", "LineNr guifg=NvimLightGrey4 ctermfg=247",
"Search ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE", "MatchParen guibg=NvimLightGrey4 ctermbg=247 gui=bold cterm=bold",
"SignColumn ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue", "ModeMsg guifg=NvimDarkGreen ctermfg=22",
"SpecialKey ctermfg=DarkBlue guifg=Blue", "MoreMsg guifg=NvimDarkCyan ctermfg=30",
"SpellBad ctermbg=LightRed guisp=Red gui=undercurl", "NonText guifg=NvimLightGrey4 ctermfg=247",
"SpellCap ctermbg=LightBlue guisp=Blue gui=undercurl", "NormalFloat guifg=NvimDarkGrey2 ctermfg=234 guibg=NvimLightGrey1 ctermbg=255",
"SpellLocal ctermbg=Cyan guisp=DarkCyan gui=undercurl", "Pmenu guifg=NvimDarkGrey2 ctermfg=234 guibg=NvimLightGrey3 ctermbg=251",
"SpellRare ctermbg=LightMagenta guisp=Magenta gui=undercurl", "PmenuSel guifg=NvimLightGrey3 ctermfg=251 guibg=NvimDarkGrey2 ctermbg=234 blend=0",
"TabLine cterm=underline ctermfg=black ctermbg=LightGrey gui=underline guibg=LightGrey", "PmenuThumb guibg=NvimLightGrey4 ctermbg=247",
"Title ctermfg=DarkMagenta gui=bold guifg=Magenta", "Question guifg=NvimDarkCyan ctermfg=30",
"Visual guibg=LightGrey", "RedrawDebugClear guibg=NvimLightCyan ctermbg=123",
"WarningMsg ctermfg=DarkRed guifg=Red", "RedrawDebugComposed guibg=NvimLightGreen ctermbg=158",
"Comment term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=Blue guibg=NONE", "RedrawDebugRecompose guibg=NvimLightRed ctermbg=217",
"Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Magenta guibg=NONE", "Search guifg=NvimDarkGrey1 ctermfg=232 guibg=NvimLightYellow ctermbg=222",
"Special term=bold cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a5acd guibg=NONE", "SignColumn guifg=NvimLightGrey4 ctermfg=247",
"Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE", "SpecialKey guifg=NvimLightGrey4 ctermfg=247",
"Statement term=bold cterm=NONE ctermfg=Brown ctermbg=NONE gui=bold guifg=Brown guibg=NONE", "SpellBad guisp=NvimDarkRed gui=undercurl cterm=undercurl",
"PreProc term=underline cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a0dad guibg=NONE", "SpellCap guisp=NvimDarkYellow gui=undercurl cterm=undercurl",
"Type term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=bold guifg=SeaGreen guibg=NONE", "SpellLocal guisp=NvimDarkGreen gui=undercurl cterm=undercurl",
"Underlined term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue", "SpellRare guisp=NvimDarkCyan gui=undercurl cterm=undercurl",
"Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE", "StatusLine guifg=NvimDarkGrey3 ctermfg=236 guibg=NvimLightGrey1 ctermbg=255",
"StatusLineNC guifg=NvimDarkGrey4 ctermfg=239 guibg=NvimLightGrey1 ctermbg=255",
"TabLine guifg=NvimDarkGrey3 ctermfg=236 guibg=NvimLightGrey1 ctermbg=255",
"Visual guibg=NvimLightGrey4 ctermbg=247",
"WarningMsg guifg=NvimDarkYellow ctermfg=52", // In 256 colors fall back to red
// Syntax
"Comment guifg=NvimDarkGrey4 ctermfg=239",
"Constant guifg=NvimDarkGrey2 ctermfg=234",
"String guifg=NvimDarkGreen ctermfg=22",
"Identifier guifg=NvimDarkBlue ctermfg=NONE", // No fallback in 256 colors to reduce noise
"Function guifg=NvimDarkCyan ctermfg=30",
"Statement guifg=NvimDarkGrey2 ctermfg=234 gui=bold cterm=bold",
"Operator guifg=NvimDarkGrey2 ctermfg=234",
"PreProc guifg=NvimDarkGrey2 ctermfg=234",
"Type guifg=NvimDarkGrey2 ctermfg=234",
"Special guifg=NvimDarkGrey2 ctermfg=234",
"Delimiter guifg=NvimDarkGrey2 ctermfg=234",
"Error guifg=NvimDarkGrey1 ctermfg=232 guibg=NvimLightRed ctermbg=217",
"Todo guifg=NvimDarkGrey1 ctermfg=232 gui=bold cterm=bold",
// Diagnostic
"DiagnosticError guifg=NvimDarkRed ctermfg=52",
"DiagnosticWarn guifg=NvimDarkYellow ctermfg=52", // In 256 colors fall back to red
"DiagnosticInfo guifg=NvimDarkCyan ctermfg=30",
"DiagnosticHint guifg=NvimDarkBlue ctermfg=30", // In 256 colors fall back to cyan
"DiagnosticOk guifg=NvimDarkGreen ctermfg=22",
"DiagnosticUnderlineError guisp=NvimDarkRed gui=underline cterm=underline",
"DiagnosticUnderlineWarn guisp=NvimDarkYellow gui=underline cterm=underline",
"DiagnosticUnderlineInfo guisp=NvimDarkCyan gui=underline cterm=underline",
"DiagnosticUnderlineHint guisp=NvimDarkBlue gui=underline cterm=underline", // In 256 colors fall back to cyan
"DiagnosticUnderlineOk guisp=NvimDarkGreen gui=underline cterm=underline",
"DiagnosticFloatingError guifg=NvimDarkRed ctermfg=52 guibg=NvimLightGrey1 ctermbg=255",
// In 256 colors fall back to red
"DiagnosticFloatingWarn guifg=NvimDarkYellow ctermfg=52 guibg=NvimLightGrey1 ctermbg=255",
"DiagnosticFloatingInfo guifg=NvimDarkCyan ctermfg=30 guibg=NvimLightGrey1 ctermbg=255",
// In 256 colors fall back to cyan
"DiagnosticFloatingHint guifg=NvimDarkBlue ctermfg=30 guibg=NvimLightGrey1 ctermbg=255",
"DiagnosticFloatingOk guifg=NvimDarkGreen ctermfg=22 guibg=NvimLightGrey1 ctermbg=255",
"DiagnosticDeprecated guisp=NvimDarkRed gui=strikethrough cterm=strikethrough",
NULL NULL
}; };
// Default colors only used with a dark background. // Default colors only used with a dark background.
static const char *highlight_init_dark[] = { static const char *highlight_init_dark[] = {
"ColorColumn ctermbg=DarkRed guibg=DarkRed", "Normal guifg=NvimLightGrey2 ctermfg=253 guibg=NvimDarkGrey2 ctermbg=234",
"CursorColumn ctermbg=DarkGrey guibg=Grey40",
"CursorLine cterm=underline guibg=Grey40", // UI
"CursorLineNr cterm=underline ctermfg=Yellow gui=bold guifg=Yellow", "ColorColumn guibg=NvimDarkGrey4 ctermbg=239",
"DiffAdd ctermbg=DarkBlue guibg=DarkBlue", "Conceal guifg=NvimDarkGrey4 ctermfg=239",
"DiffChange ctermbg=DarkMagenta guibg=DarkMagenta", "CursorColumn guibg=NvimDarkGrey3 ctermbg=236",
"DiffDelete ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan", "CursorLine guibg=NvimDarkGrey3 ctermbg=236",
"Directory ctermfg=LightCyan guifg=Cyan", "DiffAdd guifg=NvimLightGrey1 ctermfg=255 guibg=NvimDarkGreen ctermbg=22",
"FoldColumn ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan", "DiffChange guifg=NvimLightGrey1 ctermfg=255 guibg=NvimDarkGrey4 ctermbg=239",
"Folded ctermbg=DarkGrey ctermfg=Cyan guibg=DarkGrey guifg=Cyan", "DiffDelete guifg=NvimLightRed ctermfg=217 gui=bold cterm=bold",
"LineNr ctermfg=Yellow guifg=Yellow", "DiffText guifg=NvimLightGrey1 ctermfg=255 guibg=NvimDarkCyan ctermbg=30",
"MatchParen ctermbg=DarkCyan guibg=DarkCyan", "Directory guifg=NvimLightCyan ctermfg=123",
"MoreMsg ctermfg=LightGreen gui=bold guifg=SeaGreen", "ErrorMsg guifg=NvimLightRed ctermfg=217",
"Pmenu ctermbg=Magenta ctermfg=Black guibg=Magenta", "FloatShadow guibg=NvimDarkGrey1 ctermbg=232 blend=80",
"PmenuSel ctermbg=Black ctermfg=DarkGrey guibg=DarkGrey", "FloatShadowThrough guibg=NvimDarkGrey1 ctermbg=232 blend=100",
"PmenuThumb ctermbg=White guibg=White", "Folded guifg=NvimLightGrey4 ctermfg=247 guibg=NvimDarkGrey3 ctermbg=236",
"Question ctermfg=LightGreen gui=bold guifg=Green", "LineNr guifg=NvimDarkGrey4 ctermfg=239",
"Search ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black", "MatchParen guibg=NvimDarkGrey4 ctermbg=239 gui=bold cterm=bold",
"SignColumn ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan", "ModeMsg guifg=NvimLightGreen ctermfg=158",
"SpecialKey ctermfg=LightBlue guifg=Cyan", "MoreMsg guifg=NvimLightCyan ctermfg=123",
"SpellBad ctermbg=Red guisp=Red gui=undercurl", "NonText guifg=NvimDarkGrey4 ctermfg=239",
"SpellCap ctermbg=Blue guisp=Blue gui=undercurl", "NormalFloat guifg=NvimLightGrey2 ctermfg=253 guibg=NvimDarkGrey1 ctermbg=232",
"SpellLocal ctermbg=Cyan guisp=Cyan gui=undercurl", "Pmenu guifg=NvimLightGrey2 ctermfg=253 guibg=NvimDarkGrey3 ctermbg=236",
"SpellRare ctermbg=Magenta guisp=Magenta gui=undercurl", "PmenuSel guifg=NvimDarkGrey3 ctermfg=236 guibg=NvimLightGrey2 ctermbg=253 blend=0",
"TabLine cterm=underline ctermfg=white ctermbg=DarkGrey gui=underline guibg=DarkGrey", "PmenuThumb guibg=NvimDarkGrey4 ctermbg=239",
"Title ctermfg=LightMagenta gui=bold guifg=Magenta", "Question guifg=NvimLightCyan ctermfg=123",
"Visual guibg=DarkGrey", "RedrawDebugClear guibg=NvimDarkCyan ctermbg=30",
"WarningMsg ctermfg=LightRed guifg=Red", "RedrawDebugComposed guibg=NvimDarkGreen ctermbg=22",
"Comment term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE", "RedrawDebugRecompose guibg=NvimDarkRed ctermbg=52",
"Constant term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE", "Search guifg=NvimLightGrey1 ctermfg=255 guibg=NvimDarkYellow ctermbg=58",
"Special term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE", "SignColumn guifg=NvimDarkGrey4 ctermfg=239",
"Identifier term=underline cterm=bold ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE", "SpecialKey guifg=NvimDarkGrey4 ctermfg=239",
"Statement term=bold cterm=NONE ctermfg=Yellow ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE", "SpellBad guisp=NvimLightRed gui=undercurl cterm=undercurl",
"PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE", "SpellCap guisp=NvimLightYellow gui=undercurl cterm=undercurl",
"Type term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE", "SpellLocal guisp=NvimLightGreen gui=undercurl cterm=undercurl",
"Underlined term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff", "SpellRare guisp=NvimLightCyan gui=undercurl cterm=undercurl",
"Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE", "StatusLine guifg=NvimLightGrey3 ctermfg=251 guibg=NvimDarkGrey1 ctermbg=232",
"StatusLineNC guifg=NvimLightGrey4 ctermfg=247 guibg=NvimDarkGrey1 ctermbg=232",
"TabLine guifg=NvimLightGrey3 ctermfg=251 guibg=NvimDarkGrey1 ctermbg=232",
"Visual guibg=NvimDarkGrey4 ctermbg=239",
"WarningMsg guifg=NvimLightYellow ctermfg=217", // In 256 colors fall back to red
// Syntax
"Comment guifg=NvimLightGrey4 ctermfg=247",
"Constant guifg=NvimLightGrey2 ctermfg=253",
"String guifg=NvimLightGreen ctermfg=158",
"Identifier guifg=NvimLightBlue ctermfg=NONE", // No fallback in 256 colors to reduce noise
"Function guifg=NvimLightCyan ctermfg=123",
"Statement guifg=NvimLightGrey2 ctermfg=253 gui=bold cterm=bold",
"Operator guifg=NvimLightGrey2 ctermfg=253",
"PreProc guifg=NvimLightGrey2 ctermfg=253",
"Type guifg=NvimLightGrey2 ctermfg=253",
"Special guifg=NvimLightGrey2 ctermfg=253",
"Delimiter guifg=NvimLightGrey2 ctermfg=253",
"Error guifg=NvimLightGrey1 ctermfg=255 guibg=NvimDarkRed ctermbg=52",
"Todo guifg=NvimLightGrey1 ctermfg=255 gui=bold cterm=bold",
// Diagnostic
"DiagnosticError guifg=NvimLightRed ctermfg=217",
"DiagnosticWarn guifg=NvimLightYellow ctermfg=217", // In 256 colors fall back to red
"DiagnosticInfo guifg=NvimLightCyan ctermfg=123",
"DiagnosticHint guifg=NvimLightBlue ctermfg=123", // In 256 colors fall back to cyan
"DiagnosticOk guifg=NvimLightGreen ctermfg=158",
"DiagnosticUnderlineError guisp=NvimLightRed gui=underline cterm=underline",
"DiagnosticUnderlineWarn guisp=NvimLightYellow gui=underline cterm=underline", // In 256 colors fall back to red
"DiagnosticUnderlineInfo guisp=NvimLightCyan gui=underline cterm=underline",
"DiagnosticUnderlineHint guisp=NvimLightBlue gui=underline cterm=underline",
"DiagnosticUnderlineOk guisp=NvimLightGreen gui=underline cterm=underline",
"DiagnosticFloatingError guifg=NvimLightRed ctermfg=217 guibg=NvimDarkGrey1 ctermbg=232",
// In 256 colors fall back to red
"DiagnosticFloatingWarn guifg=NvimLightYellow ctermfg=217 guibg=NvimDarkGrey1 ctermbg=232",
"DiagnosticFloatingInfo guifg=NvimLightCyan ctermfg=123 guibg=NvimDarkGrey1 ctermbg=232",
// In 256 colors fall back to cyan
"DiagnosticFloatingHint guifg=NvimLightBlue ctermfg=123 guibg=NvimDarkGrey1 ctermbg=232",
"DiagnosticFloatingOk guifg=NvimLightGreen ctermfg=158 guibg=NvimDarkGrey1 ctermbg=232",
"DiagnosticDeprecated guisp=NvimLightRed gui=strikethrough cterm=strikethrough",
NULL NULL
}; };
@ -2828,6 +2886,29 @@ color_name_table_T color_name_table[] = {
{ "NavajoWhite4", RGB_(0x8b, 0x79, 0x5e) }, { "NavajoWhite4", RGB_(0x8b, 0x79, 0x5e) },
{ "Navy", RGB_(0x00, 0x00, 0x80) }, { "Navy", RGB_(0x00, 0x00, 0x80) },
{ "NavyBlue", RGB_(0x0, 0x0, 0x80) }, { "NavyBlue", RGB_(0x0, 0x0, 0x80) },
// Default Neovim palettes.
// Dark/light palette is used for background in dark/light color scheme and
// for foreground in light/dark color scheme.
{ "NvimDarkBlue", RGB_(0x00, 0x50, 0x78) }, // cterm=24
{ "NvimDarkCyan", RGB_(0x00, 0x76, 0x76) }, // cterm=30
{ "NvimDarkGreen", RGB_(0x01, 0x58, 0x25) }, // cterm=22
{ "NvimDarkGrey1", RGB_(0x0a, 0x0b, 0x10) }, // cterm=232
{ "NvimDarkGrey2", RGB_(0x1c, 0x1d, 0x23) }, // cterm=234
{ "NvimDarkGrey3", RGB_(0x2c, 0x2e, 0x33) }, // cterm=236
{ "NvimDarkGrey4", RGB_(0x4f, 0x52, 0x58) }, // cterm=239
{ "NvimDarkMagenta", RGB_(0x4c, 0x00, 0x49) }, // cterm=53
{ "NvimDarkRed", RGB_(0x5e, 0x00, 0x09) }, // cterm=52
{ "NvimDarkYellow", RGB_(0x6e, 0x56, 0x00) }, // cterm=58
{ "NvimLightBlue", RGB_(0x9f, 0xd8, 0xff) }, // cterm=153
{ "NvimLightCyan", RGB_(0x83, 0xef, 0xef) }, // cterm=123
{ "NvimLightGreen", RGB_(0xaa, 0xed, 0xb7) }, // cterm=158
{ "NvimLightGrey1", RGB_(0xeb, 0xee, 0xf5) }, // cterm=255
{ "NvimLightGrey2", RGB_(0xd7, 0xda, 0xe1) }, // cterm=253
{ "NvimLightGrey3", RGB_(0xc4, 0xc6, 0xcd) }, // cterm=251
{ "NvimLightGrey4", RGB_(0x9b, 0x9e, 0xa4) }, // cterm=247
{ "NvimLightMagenta", RGB_(0xff, 0xc3, 0xfa) }, // cterm=189
{ "NvimLightRed", RGB_(0xff, 0xbc, 0xb5) }, // cterm=217
{ "NvimLightYellow", RGB_(0xf4, 0xd8, 0x8c) }, // cterm=222
{ "OldLace", RGB_(0xfd, 0xf5, 0xe6) }, { "OldLace", RGB_(0xfd, 0xf5, 0xe6) },
{ "Olive", RGB_(0x80, 0x80, 0x00) }, { "Olive", RGB_(0x80, 0x80, 0x00) },
{ "OliveDrab", RGB_(0x6b, 0x8e, 0x23) }, { "OliveDrab", RGB_(0x6b, 0x8e, 0x23) },

View File

@ -561,7 +561,7 @@ describe('API: get highlight', function()
end) end)
it('can correctly detect links', function() it('can correctly detect links', function()
command('hi String guifg=#a6e3a1') command('hi String guifg=#a6e3a1 ctermfg=NONE')
command('hi link @string string') command('hi link @string string')
command('hi link @string.cpp @string') command('hi link @string.cpp @string')
eq({ fg = 10937249 }, meths.get_hl(0, { name = 'String' })) eq({ fg = 10937249 }, meths.get_hl(0, { name = 'String' }))

View File

@ -14,8 +14,10 @@ describe('autoread TUI FocusGained/FocusLost', function()
before_each(function() before_each(function()
clear() clear()
screen = thelpers.screen_setup(0, '["'..nvim_prog screen = thelpers.screen_setup(
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]') 0,
'["'..nvim_prog..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "set noswapfile noshowcmd noruler"]'
)
end) end)
teardown(function() teardown(function()

View File

@ -70,17 +70,18 @@ describe('command-line option', function()
-- data from the terminal #18181 -- data from the terminal #18181
funcs.termopen(string.format([[echo "" | %s]], table.concat(args, " "))) funcs.termopen(string.format([[echo "" | %s]], table.concat(args, " ")))
screen:expect([[ screen:expect([[
^ | {1:^ }|
{1:~ }| {2:~ }|
{1:~ }| {2:~ }|
{1:~ }| {2:~ }|
{1:~ }| {2:~ }|
{2:[No Name] 0,0-1 All}| {3:[No Name] 0,0-1 All}|
| {1: }|
| |
]], { ]], {
[1] = {foreground = tonumber('0x4040ff'), fg_indexed=true}, [1] = {bg_indexed = true, foreground = Screen.colors.Grey91, background = tonumber('0x161616'), fg_indexed = true},
[2] = {bold = true, reverse = true} [2] = {bg_indexed = true, foreground = Screen.colors.Gray30, background = tonumber('0x161616'), fg_indexed = true},
[3] = {bg_indexed = true, foreground = tonumber('0xd2d2d2'), background = Screen.colors.Black , fg_indexed = true},
}) })
feed('i:cq<CR>') feed('i:cq<CR>')
screen:expect([[ screen:expect([[

View File

@ -38,6 +38,11 @@ module.nvim_argv = {
'--cmd', module.nvim_set, '--cmd', module.nvim_set,
'--cmd', 'mapclear', '--cmd', 'mapclear',
'--cmd', 'mapclear!', '--cmd', 'mapclear!',
-- Make screentest work after changing to the new default color scheme
-- Source 'vim' color scheme without side effects
-- TODO: rewrite tests
'--cmd', 'lua f=io.open("runtime/colors/vim.vim", "r"); l=f:read("*a"); f:close(); vim.api.nvim_exec2(l, {})',
'--cmd', 'unlet g:colors_name',
'--embed'} '--embed'}
-- Directory containing nvim. -- Directory containing nvim.

View File

@ -12,7 +12,7 @@ describe('api', function()
helpers.clear() helpers.clear()
os.remove(socket_name) os.remove(socket_name)
screen = child_session.screen_setup(0, '["'..helpers.nvim_prog screen = child_session.screen_setup(0, '["'..helpers.nvim_prog
..'", "-u", "NONE", "-i", "NONE", "--cmd", "'..helpers.nvim_set..'"]') ..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "'..helpers.nvim_set..'"]')
end) end)
after_each(function() after_each(function()
os.remove(socket_name) os.remove(socket_name)

View File

@ -446,8 +446,10 @@ end)
describe('terminal input', function() describe('terminal input', function()
it('sends various special keys with modifiers', function() it('sends various special keys with modifiers', function()
clear() clear()
local screen = thelpers.screen_setup(0, local screen = thelpers.screen_setup(
string.format([=[["%s", "-u", "NONE", "-i", "NONE", "--cmd", "startinsert"]]=], nvim_prog)) 0,
string.format([=[["%s", "-u", "NONE", "-i", "NONE", "--cmd", 'colorscheme vim', "--cmd", "startinsert"]]=], nvim_prog)
)
screen:expect{grid=[[ screen:expect{grid=[[
{1: } | {1: } |
{4:~ }| {4:~ }|

View File

@ -188,16 +188,22 @@ describe('buffer cursor position is correct in terminal without number column',
..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]] ..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]]
-- <Left> and <Right> don't always work -- <Left> and <Right> don't always work
..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70) ..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70)
screen:set_default_attr_ids({
[1] = {foreground = 253, background = 11};
[3] = {bold = true},
[16] = {background = 234, foreground = 253};
[17] = {reverse = true, background = 234, foreground = 253};
})
-- Also check for real cursor position, as it is used for stuff like input methods -- Also check for real cursor position, as it is used for stuff like input methods
screen._handle_busy_start = function() end screen._handle_busy_start = function() end
screen._handle_busy_stop = function() end screen._handle_busy_stop = function() end
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:{1:^ } | {16::}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
end end
@ -212,23 +218,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:aaaaaaaa{1:^ } | {16::aaaaaaaa}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 9}, eval('nvim_win_get_cursor(0)')) eq({6, 9}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:aaaaaaa^a{2: } | {16::aaaaaaa^a}{1: }{16: }|
| |
]]) ]])
eq({6, 8}, eval('nvim_win_get_cursor(0)')) eq({6, 8}, eval('nvim_win_get_cursor(0)'))
@ -237,23 +243,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:aaaaaa{1:^a}a | {16::aaaaaa}{17:^a}{16:a }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 7}, eval('nvim_win_get_cursor(0)')) eq({6, 7}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:aaaaa^a{2:a}a | {16::aaaaa^a}{1:a}{16:a }|
| |
]]) ]])
eq({6, 6}, eval('nvim_win_get_cursor(0)')) eq({6, 6}, eval('nvim_win_get_cursor(0)'))
@ -262,23 +268,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:a{1:^a}aaaaaa | {16::a}{17:^a}{16:aaaaaa }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 2}, eval('nvim_win_get_cursor(0)')) eq({6, 2}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:^a{2:a}aaaaaa | {16::^a}{1:a}{16:aaaaaa }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -293,23 +299,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µµµµµµµµ{1:^ } | {16::µµµµµµµµ}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 17}, eval('nvim_win_get_cursor(0)')) eq({6, 17}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µµµµµµµ^µ{2: } | {16::µµµµµµµ^µ}{1: }{16: }|
| |
]]) ]])
eq({6, 15}, eval('nvim_win_get_cursor(0)')) eq({6, 15}, eval('nvim_win_get_cursor(0)'))
@ -318,23 +324,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µµµµµµ{1:^µ}µ | {16::µµµµµµ}{17:^µ}{16:µ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 13}, eval('nvim_win_get_cursor(0)')) eq({6, 13}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µµµµµ^µ{2:µ}µ | {16::µµµµµ^µ}{1:µ}{16:µ }|
| |
]]) ]])
eq({6, 11}, eval('nvim_win_get_cursor(0)')) eq({6, 11}, eval('nvim_win_get_cursor(0)'))
@ -343,23 +349,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µ{1:^µ}µµµµµµ | {16::µ}{17:^µ}{16:µµµµµµ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 3}, eval('nvim_win_get_cursor(0)')) eq({6, 3}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:^µ{2:µ}µµµµµµ | {16::^µ}{1:µ}{16:µµµµµµ }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -376,23 +382,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1:^ } | {16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 33}, eval('nvim_win_get_cursor(0)')) eq({6, 33}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳{2: } | {16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳}{1: }{16: }|
| |
]]) ]])
eq({6, 29}, eval('nvim_win_get_cursor(0)')) eq({6, 29}, eval('nvim_win_get_cursor(0)'))
@ -401,23 +407,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µ̳µ̳µ̳µ̳µ̳µ̳{1:^µ̳}µ̳ | {16::µ̳µ̳µ̳µ̳µ̳µ̳}{17:^µ̳}{16:µ̳ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 25}, eval('nvim_win_get_cursor(0)')) eq({6, 25}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µ̳µ̳µ̳µ̳µ̳^µ̳{2:µ̳}µ̳ | {16::µ̳µ̳µ̳µ̳µ̳^µ̳}{1:µ̳}{16:µ̳ }|
| |
]]) ]])
eq({6, 21}, eval('nvim_win_get_cursor(0)')) eq({6, 21}, eval('nvim_win_get_cursor(0)'))
@ -426,23 +432,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:µ̳{1:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | {16::µ̳}{17:^µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 5}, eval('nvim_win_get_cursor(0)')) eq({6, 5}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:^µ̳{2:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | {16::^µ̳}{1:µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -459,23 +465,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:{1:^ } | {16::哦哦哦哦哦哦哦哦}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 25}, eval('nvim_win_get_cursor(0)')) eq({6, 25}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:^{2: } | {16::哦哦哦哦哦哦哦^}{1: }{16: }|
| |
]]) ]])
eq({6, 22}, eval('nvim_win_get_cursor(0)')) eq({6, 22}, eval('nvim_win_get_cursor(0)'))
@ -484,23 +490,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:{1:^} | {16::哦哦哦哦哦哦}{17:^}{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 19}, eval('nvim_win_get_cursor(0)')) eq({6, 19}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:^{2:} | {16::哦哦哦哦哦^}{1:}{16: }|
| |
]]) ]])
eq({6, 16}, eval('nvim_win_get_cursor(0)')) eq({6, 16}, eval('nvim_win_get_cursor(0)'))
@ -509,23 +515,23 @@ describe('buffer cursor position is correct in terminal without number column',
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:{1:^} | {16::}{17:^}{16:哦哦哦哦哦哦 }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 4}, eval('nvim_win_get_cursor(0)')) eq({6, 4}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:^{2:} | {16::^}{1:}{16:哦哦哦哦哦哦 }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -536,24 +542,24 @@ describe('buffer cursor position is correct in terminal without number column',
setup_ex_register('aaaaaaaa ') setup_ex_register('aaaaaaaa ')
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:aaaaaaaa {1:^ } | {16::aaaaaaaa }{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()')) matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()'))
eq({6, 13}, eval('nvim_win_get_cursor(0)')) eq({6, 13}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
| {16: }|
| {16: }|
| {16: }|
| {16: }|
Entering Ex mode. Type "visual" to go to Normal mode. | {16:Entering Ex mode. Type "visual" to go to Normal mode. }|
:aaaaaaaa ^ {2: } | {16::aaaaaaaa ^ }{1: }{16: }|
| |
]]) ]])
eq({6, 12}, eval('nvim_win_get_cursor(0)')) eq({6, 12}, eval('nvim_win_get_cursor(0)'))
@ -568,16 +574,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]] ..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]]
-- <Left> and <Right> don't always work -- <Left> and <Right> don't always work
..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70) ..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70)
screen:set_default_attr_ids({
[1] = {foreground = 253, background = 11};
[3] = {bold = true},
[7] = {foreground = 130};
[16] = {background = 234, foreground = 253};
[17] = {reverse = true, background = 234, foreground = 253};
})
-- Also check for real cursor position, as it is used for stuff like input methods -- Also check for real cursor position, as it is used for stuff like input methods
screen._handle_busy_start = function() end screen._handle_busy_start = function() end
screen._handle_busy_stop = function() end screen._handle_busy_stop = function() end
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:{1:^ } | {7: 6 }{16::}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
end end
@ -595,23 +608,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:aaaaaaaa{1:^ } | {7: 6 }{16::aaaaaaaa}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 9}, eval('nvim_win_get_cursor(0)')) eq({6, 9}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:aaaaaaa^a{2: } | {7: 6 }{16::aaaaaaa^a}{1: }{16: }|
| |
]]) ]])
eq({6, 8}, eval('nvim_win_get_cursor(0)')) eq({6, 8}, eval('nvim_win_get_cursor(0)'))
@ -620,23 +633,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:aaaaaa{1:^a}a | {7: 6 }{16::aaaaaa}{17:^a}{16:a }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 7}, eval('nvim_win_get_cursor(0)')) eq({6, 7}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:aaaaa^a{2:a}a | {7: 6 }{16::aaaaa^a}{1:a}{16:a }|
| |
]]) ]])
eq({6, 6}, eval('nvim_win_get_cursor(0)')) eq({6, 6}, eval('nvim_win_get_cursor(0)'))
@ -645,23 +658,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:a{1:^a}aaaaaa | {7: 6 }{16::a}{17:^a}{16:aaaaaa }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 2}, eval('nvim_win_get_cursor(0)')) eq({6, 2}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:^a{2:a}aaaaaa | {7: 6 }{16::^a}{1:a}{16:aaaaaa }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -676,23 +689,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µµµµµµµµ{1:^ } | {7: 6 }{16::µµµµµµµµ}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 17}, eval('nvim_win_get_cursor(0)')) eq({6, 17}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µµµµµµµ^µ{2: } | {7: 6 }{16::µµµµµµµ^µ}{1: }{16: }|
| |
]]) ]])
eq({6, 15}, eval('nvim_win_get_cursor(0)')) eq({6, 15}, eval('nvim_win_get_cursor(0)'))
@ -701,23 +714,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µµµµµµ{1:^µ}µ | {7: 6 }{16::µµµµµµ}{17:^µ}{16:µ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 13}, eval('nvim_win_get_cursor(0)')) eq({6, 13}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µµµµµ^µ{2:µ}µ | {7: 6 }{16::µµµµµ^µ}{1:µ}{16:µ }|
| |
]]) ]])
eq({6, 11}, eval('nvim_win_get_cursor(0)')) eq({6, 11}, eval('nvim_win_get_cursor(0)'))
@ -726,23 +739,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µ{1:^µ}µµµµµµ | {7: 6 }{16::µ}{17:^µ}{16:µµµµµµ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 3}, eval('nvim_win_get_cursor(0)')) eq({6, 3}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:^µ{2:µ}µµµµµµ | {7: 6 }{16::^µ}{1:µ}{16:µµµµµµ }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -759,23 +772,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1:^ } | {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 33}, eval('nvim_win_get_cursor(0)')) eq({6, 33}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳{2: } | {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳}{1: }{16: }|
| |
]]) ]])
eq({6, 29}, eval('nvim_win_get_cursor(0)')) eq({6, 29}, eval('nvim_win_get_cursor(0)'))
@ -784,23 +797,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳{1:^µ̳}µ̳ | {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳µ̳}{17:^µ̳}{16:µ̳ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 25}, eval('nvim_win_get_cursor(0)')) eq({6, 25}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µ̳µ̳µ̳µ̳µ̳^µ̳{2:µ̳}µ̳ | {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳^µ̳}{1:µ̳}{16:µ̳ }|
| |
]]) ]])
eq({6, 21}, eval('nvim_win_get_cursor(0)')) eq({6, 21}, eval('nvim_win_get_cursor(0)'))
@ -809,23 +822,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:µ̳{1:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | {7: 6 }{16::µ̳}{17:^µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 5}, eval('nvim_win_get_cursor(0)')) eq({6, 5}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:^µ̳{2:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | {7: 6 }{16::^µ̳}{1:µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -842,23 +855,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('at the end', function() it('at the end', function()
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:{1:^ } | {7: 6 }{16::哦哦哦哦哦哦哦哦}{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 25}, eval('nvim_win_get_cursor(0)')) eq({6, 25}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:^{2: } | {7: 6 }{16::哦哦哦哦哦哦哦^}{1: }{16: }|
| |
]]) ]])
eq({6, 22}, eval('nvim_win_get_cursor(0)')) eq({6, 22}, eval('nvim_win_get_cursor(0)'))
@ -867,23 +880,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the end', function() it('near the end', function()
feed('<C-R>r<C-X><C-X>') feed('<C-R>r<C-X><C-X>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:{1:^} | {7: 6 }{16::哦哦哦哦哦哦}{17:^}{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 19}, eval('nvim_win_get_cursor(0)')) eq({6, 19}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:^{2:} | {7: 6 }{16::哦哦哦哦哦^}{1:}{16: }|
| |
]]) ]])
eq({6, 16}, eval('nvim_win_get_cursor(0)')) eq({6, 16}, eval('nvim_win_get_cursor(0)'))
@ -892,23 +905,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
it('near the start', function() it('near the start', function()
feed('<C-R>r<C-B><C-O>') feed('<C-R>r<C-B><C-O>')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:{1:^} | {7: 6 }{16::}{17:^}{16:哦哦哦哦哦哦 }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
eq({6, 4}, eval('nvim_win_get_cursor(0)')) eq({6, 4}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:^{2:} | {7: 6 }{16::^}{1:}{16:哦哦哦哦哦哦 }|
| |
]]) ]])
eq({6, 1}, eval('nvim_win_get_cursor(0)')) eq({6, 1}, eval('nvim_win_get_cursor(0)'))
@ -919,24 +932,24 @@ describe('buffer cursor position is correct in terminal with number column', fun
setup_ex_register('aaaaaaaa ') setup_ex_register('aaaaaaaa ')
feed('<C-R>r') feed('<C-R>r')
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:aaaaaaaa {1:^ } | {7: 6 }{16::aaaaaaaa }{17:^ }{16: }|
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()')) matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()'))
eq({6, 13}, eval('nvim_win_get_cursor(0)')) eq({6, 13}, eval('nvim_win_get_cursor(0)'))
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
{7: 1 } | {7: 1 }{16: }|
{7: 2 } | {7: 2 }{16: }|
{7: 3 } | {7: 3 }{16: }|
{7: 4 } | {7: 4 }{16: }|
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }|
{7: 6 }:aaaaaaaa ^ {2: } | {7: 6 }{16::aaaaaaaa ^ }{1: }{16: }|
| |
]]) ]])
eq({6, 12}, eval('nvim_win_get_cursor(0)')) eq({6, 12}, eval('nvim_win_get_cursor(0)'))

View File

@ -40,8 +40,12 @@ describe('TUI', function()
clear() clear()
local child_server = new_pipename() local child_server = new_pipename()
screen = thelpers.screen_setup(0, screen = thelpers.screen_setup(0,
string.format([=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark"]]=], string.format(
nvim_prog, child_server, nvim_set)) [=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark", "--cmd", "colorscheme vim"]]=],
nvim_prog,
child_server,
nvim_set
))
screen:expect([[ screen:expect([[
{1: } | {1: } |
{4:~ }| {4:~ }|
@ -1826,7 +1830,7 @@ describe('TUI', function()
}) })
screen:attach() screen:attach()
exec([[ exec([[
call termopen([v:progpath, '--clean', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile']) call termopen([v:progpath, '--clean', '--cmd', 'colorscheme vim', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile'])
sleep 500m sleep 500m
vs new vs new
]]) ]])
@ -1852,7 +1856,7 @@ describe('TUI', function()
write_file(script_file, [=[ write_file(script_file, [=[
local ffi = require('ffi') local ffi = require('ffi')
ffi.cdef([[int execl(const char *, const char *, ...);]]) ffi.cdef([[int execl(const char *, const char *, ...);]])
ffi.C.execl(vim.v.progpath, 'Xargv0nvim', '--clean') ffi.C.execl(vim.v.progpath, 'Xargv0nvim', '--clean', '--cmd', 'colorscheme vim')
]=]) ]=])
finally(function() finally(function()
os.remove(script_file) os.remove(script_file)
@ -1870,12 +1874,12 @@ describe('TUI', function()
]]} ]]}
feed_data(':put =v:argv + [v:progname]\n') feed_data(':put =v:argv + [v:progname]\n')
screen:expect{grid=[[ screen:expect{grid=[[
Xargv0nvim |
--embed |
--clean | --clean |
--cmd |
colorscheme vim |
{1:X}argv0nvim | {1:X}argv0nvim |
{5:[No Name] [+] 5,1 Bot}| {5:[No Name] [+] 7,1 Bot}|
4 more lines | 6 more lines |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]} ]]}
end) end)
@ -1899,8 +1903,11 @@ describe('TUI', function()
end) end)
it('<C-h> #10134', function() it('<C-h> #10134', function()
local screen = thelpers.screen_setup(0, '["'..nvim_prog local screen = thelpers.screen_setup(
..[[", "-u", "NONE", "-i", "NONE", "--cmd", "set noruler", "--cmd", ':nnoremap <C-h> :echomsg "\<C-h\>"<CR>']]..']') 0,
'["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", ]]
..[["--cmd", "set noruler", "--cmd", ':nnoremap <C-h> :echomsg "\<C-h\>"<CR>']]..']'
)
screen:expect{grid=[[ screen:expect{grid=[[
{1: } | {1: } |
{4:~ }| {4:~ }|
@ -1924,8 +1931,12 @@ describe('TUI', function()
end) end)
it('draws line with many trailing spaces correctly #24955', function() it('draws line with many trailing spaces correctly #24955', function()
local screen = thelpers.screen_setup(0, '["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE"]] local screen = thelpers.screen_setup(
..[[, "--cmd", "call setline(1, ['1st line' .. repeat(' ', 153), '2nd line'])"]]..']', 80) 0,
'["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim"]]
..[[, "--cmd", "call setline(1, ['1st line' .. repeat(' ', 153), '2nd line'])"]]..']',
80
)
screen:expect{grid=[[ screen:expect{grid=[[
{1:1}st line | {1:1}st line |
| |
@ -1953,6 +1964,7 @@ describe('TUI UIEnter/UILeave', function()
clear() clear()
local screen = thelpers.screen_setup(0, local screen = thelpers.screen_setup(0,
'["'..nvim_prog..'", "-u", "NONE", "-i", "NONE"' '["'..nvim_prog..'", "-u", "NONE", "-i", "NONE"'
..[[, "--cmd", "colorscheme vim"]]
..[[, "--cmd", "set noswapfile noshowcmd noruler"]] ..[[, "--cmd", "set noswapfile noshowcmd noruler"]]
..[[, "--cmd", "let g:evs = []"]] ..[[, "--cmd", "let g:evs = []"]]
..[[, "--cmd", "autocmd UIEnter * :call add(g:evs, 'UIEnter')"]] ..[[, "--cmd", "autocmd UIEnter * :call add(g:evs, 'UIEnter')"]]
@ -1991,7 +2003,8 @@ describe('TUI FocusGained/FocusLost', function()
local child_server = new_pipename() local child_server = new_pipename()
screen = thelpers.screen_setup(0, screen = thelpers.screen_setup(0,
string.format( string.format(
[=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]]=], '["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", '
..'"--cmd", "set noswapfile noshowcmd noruler"]',
nvim_prog, child_server)) nvim_prog, child_server))
screen:expect([[ screen:expect([[
{1: } | {1: } |
@ -2198,14 +2211,16 @@ describe("TUI 't_Co' (terminal colors)", function()
-- This is ugly because :term/termopen() forces TERM=xterm-256color. -- This is ugly because :term/termopen() forces TERM=xterm-256color.
-- TODO: Revisit this after jobstart/termopen accept `env` dict. -- TODO: Revisit this after jobstart/termopen accept `env` dict.
screen = thelpers.screen_setup(0, string.format( screen = thelpers.screen_setup(0, string.format(
[=[['sh', '-c', 'LANG=C TERM=%s %s %s -u NONE -i NONE --cmd "%s"']]=], [=[['sh', '-c', 'LANG=C TERM=%s %s %s -u NONE -i NONE --cmd "colorscheme vim" --cmd "%s"']]=],
term or "", term or "",
(colorterm ~= nil and "COLORTERM="..colorterm or ""), (colorterm ~= nil and "COLORTERM="..colorterm or ""),
nvim_prog, nvim_prog,
nvim_set)) nvim_set))
local tline local tline
if maxcolors == 8 or maxcolors == 16 then if maxcolors == 8 then
tline = "{9:~ }"
elseif maxcolors == 16 then
tline = "~ " tline = "~ "
else else
tline = "{4:~ }" tline = "{4:~ }"
@ -2528,7 +2543,7 @@ describe("TUI", function()
-- This is ugly because :term/termopen() forces TERM=xterm-256color. -- This is ugly because :term/termopen() forces TERM=xterm-256color.
-- TODO: Revisit this after jobstart/termopen accept `env` dict. -- TODO: Revisit this after jobstart/termopen accept `env` dict.
local cmd = string.format( local cmd = string.format(
[=[['sh', '-c', 'LANG=C %s -u NONE -i NONE %s --cmd "%s"']]=], [=[['sh', '-c', 'LANG=C %s -u NONE -i NONE %s --cmd "colorscheme vim" --cmd "%s"']]=],
nvim_prog, nvim_prog,
extra_args or "", extra_args or "",
nvim_set) nvim_set)
@ -2591,7 +2606,7 @@ describe('TUI bg color', function()
local function setup_bg_test() local function setup_bg_test()
clear() clear()
screen = thelpers.screen_setup(0, '["'..nvim_prog screen = thelpers.screen_setup(0, '["'..nvim_prog
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile", ' ..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "set noswapfile", '
..'"-c", "autocmd OptionSet background echo \\"did OptionSet, yay!\\""]') ..'"-c", "autocmd OptionSet background echo \\"did OptionSet, yay!\\""]')
end end
@ -2712,8 +2727,13 @@ describe("TUI as a client", function()
set_session(server_super) set_session(server_super)
local server_pipe = new_pipename() local server_pipe = new_pipename()
local screen_server = thelpers.screen_setup(0, local screen_server = thelpers.screen_setup(0,
string.format([=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark"]]=], string.format(
nvim_prog, server_pipe, nvim_set)) '["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", '
..'"--cmd", "%s laststatus=2 background=dark"]',
nvim_prog,
server_pipe,
nvim_set
))
feed_data("iHello, World") feed_data("iHello, World")
screen_server:expect{grid=[[ screen_server:expect{grid=[[
@ -2839,8 +2859,13 @@ describe("TUI as a client", function()
set_session(server_super) set_session(server_super)
local server_pipe = new_pipename() local server_pipe = new_pipename()
local screen_server = thelpers.screen_setup(0, local screen_server = thelpers.screen_setup(0,
string.format([=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark"]]=], string.format(
nvim_prog, server_pipe, nvim_set)) '["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", '
..'"--cmd", "%s laststatus=2 background=dark"]',
nvim_prog,
server_pipe,
nvim_set
))
screen_server:expect{grid=[[ screen_server:expect{grid=[[
{1: } | {1: } |
{4:~ }| {4:~ }|

View File

@ -215,7 +215,7 @@ describe('ui/cursor', function()
m.hl_id = 64 m.hl_id = 64
m.attr = {background = Screen.colors.DarkGray} m.attr = {background = Screen.colors.DarkGray}
end end
if m.id_lm then m.id_lm = 67 end if m.id_lm then m.id_lm = 69 end
end end
-- Assert the new expectation. -- Assert the new expectation.

View File

@ -26,6 +26,12 @@ local function test_embed(ext_linegrid)
[3] = {bold = true, foreground = Screen.colors.Blue1}, [3] = {bold = true, foreground = Screen.colors.Blue1},
[4] = {bold = true, foreground = Screen.colors.Green}, [4] = {bold = true, foreground = Screen.colors.Green},
[5] = {bold = true, reverse = true}, [5] = {bold = true, reverse = true},
[6] = {foreground = Screen.colors.NvimDarkGrey3, background = Screen.colors.NvimLightGrey1};
[7] = {foreground = Screen.colors.NvimDarkRed};
[8] = {foreground = Screen.colors.NvimDarkCyan};
[9] = {foreground = Screen.colors.NvimLightGrey3, background = Screen.colors.NvimDarkGrey1};
[10] = {foreground = Screen.colors.NvimLightRed};
[11] = {foreground = Screen.colors.NvimLightCyan};
}) })
end end
@ -36,10 +42,10 @@ local function test_embed(ext_linegrid)
| |
| |
| |
| {6: }|
Error detected while processing pre-vimrc command line: | {7:Error detected while processing pre-vimrc command line:} |
E121: Undefined variable: invalid | {7:E121: Undefined variable: invalid} |
Press ENTER or type command to continue^ | {8:Press ENTER or type command to continue}^ |
]]) ]])
feed('<cr>') feed('<cr>')
@ -64,11 +70,11 @@ local function test_embed(ext_linegrid)
| |
| |
| |
{5: }| {9: }|
Error detected while processing pre-vimrc command line: | {7:Error detected while processing pre-vimrc command line:} |
foo | {7:foo} |
{1:bar} | {10:bar} |
{4:Press ENTER or type command to continue}^ | {11:Press ENTER or type command to continue}^ |
]]) ]])
end) end)
@ -78,11 +84,11 @@ local function test_embed(ext_linegrid)
| |
| |
| |
| {6: }|
Error detected while processing pre-vimrc command line: | {7:Error detected while processing pre-vimrc command line:} |
foo | {7:foo} |
bar | {7:bar} |
Press ENTER or type command to continue^ | {8:Press ENTER or type command to continue}^ |
]], condition=function() ]], condition=function()
eq(Screen.colors.Green, screen.default_colors.rgb_bg) eq(Screen.colors.Green, screen.default_colors.rgb_bg)
end} end}
@ -144,7 +150,7 @@ describe('--embed --listen UI', function()
helpers.skip(helpers.is_os('win')) helpers.skip(helpers.is_os('win'))
clear() clear()
local child_server = assert(helpers.new_pipename()) local child_server = assert(helpers.new_pipename())
funcs.jobstart({nvim_prog, '--embed', '--listen', child_server, '--clean'}) funcs.jobstart({nvim_prog, '--embed', '--listen', child_server, '--clean', '--cmd', 'colorscheme vim'})
retry(nil, nil, function() neq(nil, uv.fs_stat(child_server)) end) retry(nil, nil, function() neq(nil, uv.fs_stat(child_server)) end)
local child_session = helpers.connect(child_server) local child_session = helpers.connect(child_server)

View File

@ -1185,7 +1185,7 @@ describe('float window', function()
it('defaults to NormalFloat highlight and inherited options', function() it('defaults to NormalFloat highlight and inherited options', function()
command('set number') command('set number')
command('hi NormalFloat guibg=#333333') command('hi NormalFloat guibg=#333333 guifg=NONE')
feed('ix<cr>y<cr><esc>gg') feed('ix<cr>y<cr><esc>gg')
local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10}) local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10})
if multigrid then if multigrid then
@ -1271,7 +1271,7 @@ describe('float window', function()
command('set colorcolumn=1') command('set colorcolumn=1')
command('set cursorline') command('set cursorline')
command('set foldcolumn=1') command('set foldcolumn=1')
command('hi NormalFloat guibg=#333333') command('hi NormalFloat guibg=#333333 guifg=NONE')
feed('ix<cr>y<cr><esc>gg') feed('ix<cr>y<cr><esc>gg')
local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'})
if multigrid then if multigrid then
@ -1399,7 +1399,7 @@ describe('float window', function()
command('set colorcolumn=1') command('set colorcolumn=1')
command('set cursorline') command('set cursorline')
command('set foldcolumn=1') command('set foldcolumn=1')
command('hi NormalFloat guibg=#333333') command('hi NormalFloat guibg=#333333 guifg=NONE')
feed('ix<cr>y<cr><esc>gg') feed('ix<cr>y<cr><esc>gg')
local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'})
if multigrid then if multigrid then
@ -1528,7 +1528,7 @@ describe('float window', function()
command('set cursorline') command('set cursorline')
command('set foldcolumn=1') command('set foldcolumn=1')
command('set statuscolumn=%l%s%C') command('set statuscolumn=%l%s%C')
command('hi NormalFloat guibg=#333333') command('hi NormalFloat guibg=#333333 guifg=NONE')
feed('ix<cr>y<cr><esc>gg') feed('ix<cr>y<cr><esc>gg')
meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'})
if multigrid then if multigrid then
@ -5921,7 +5921,7 @@ describe('float window', function()
describe('float shown after pum', function() describe('float shown after pum', function()
local win local win
before_each(function() before_each(function()
command('hi NormalFloat guibg=#333333') command('hi NormalFloat guibg=#333333 guifg=NONE')
feed('i') feed('i')
funcs.complete(1, {'aa', 'word', 'longtext'}) funcs.complete(1, {'aa', 'word', 'longtext'})
if multigrid then if multigrid then

View File

@ -72,7 +72,7 @@ describe('ext_hlstate detailed highlights', function()
[6] = {{}, {{hi_name = "StatusLineNC", ui_name = "StatusLineNC", kind = "ui"}}}, [6] = {{}, {{hi_name = "StatusLineNC", ui_name = "StatusLineNC", kind = "ui"}}},
[7] = {{}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}}, [7] = {{}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}},
}) })
command("hi clear VertSplit") command("hi clear WinSeparator")
command("vsplit") command("vsplit")
screen:expect([[ screen:expect([[

View File

@ -22,7 +22,7 @@ describe("shell command :!", function()
before_each(function() before_each(function()
clear() clear()
screen = child_session.screen_setup(0, '["'..helpers.nvim_prog.. screen = child_session.screen_setup(0, '["'..helpers.nvim_prog..
'", "-u", "NONE", "-i", "NONE", "--cmd", "'..helpers.nvim_set..'"]') '", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "'..helpers.nvim_set..'"]')
screen:expect([[ screen:expect([[
{1: } | {1: } |
{4:~ }| {4:~ }|

View File

@ -89,7 +89,7 @@ describe('quickfix selection highlight', function()
end) end)
it('using QuickFixLine highlight group', function() it('using QuickFixLine highlight group', function()
command('highlight QuickFixLine guibg=Red') command('highlight QuickFixLine guibg=Red guifg=NONE gui=NONE')
command('copen') command('copen')
@ -124,7 +124,7 @@ describe('quickfix selection highlight', function()
it('combines with CursorLine', function() it('combines with CursorLine', function()
command('set cursorline') command('set cursorline')
command('highlight QuickFixLine guifg=Red') command('highlight QuickFixLine guifg=Red guibg=NONE gui=NONE')
command('highlight CursorLine guibg=Fuchsia') command('highlight CursorLine guibg=Fuchsia')
command('copen') command('copen')
@ -160,7 +160,7 @@ describe('quickfix selection highlight', function()
it('QuickFixLine background takes precedence over CursorLine', function() it('QuickFixLine background takes precedence over CursorLine', function()
command('set cursorline') command('set cursorline')
command('highlight QuickFixLine guibg=Red') command('highlight QuickFixLine guibg=Red guifg=NONE gui=NONE')
command('highlight CursorLine guibg=Fuchsia') command('highlight CursorLine guibg=Fuchsia')
command('copen') command('copen')

View File

@ -8,9 +8,15 @@ local funcs, meths = helpers.funcs, helpers.meths
describe('screen', function() describe('screen', function()
local screen local screen
local nvim_argv = {helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N', local nvim_argv = {
'--cmd', 'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler', helpers.nvim_prog,
'--embed'} '-u', 'NONE',
'-i', 'NONE',
'-N',
'--cmd', 'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler',
'--cmd', 'colorscheme vim',
'--embed',
}
before_each(function() before_each(function()
local screen_nvim = spawn(nvim_argv) local screen_nvim = spawn(nvim_argv)
@ -997,9 +1003,15 @@ describe('Screen default colors', function()
local function startup(light, termcolors) local function startup(light, termcolors)
local extra = (light and ' background=light') or '' local extra = (light and ' background=light') or ''
local nvim_argv = {helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N', local nvim_argv = {
'--cmd', 'set shortmess+=I noswapfile belloff= noshowcmd noruler'..extra, helpers.nvim_prog,
'--embed'} '-u', 'NONE',
'-i', 'NONE',
'-N',
'--cmd', 'set shortmess+=I noswapfile belloff= noshowcmd noruler'..extra,
'--cmd', 'colorscheme vim',
'--embed',
}
local screen_nvim = spawn(nvim_argv) local screen_nvim = spawn(nvim_argv)
set_session(screen_nvim) set_session(screen_nvim)
screen = Screen.new() screen = Screen.new()
@ -1017,7 +1029,7 @@ describe('Screen default colors', function()
it('can be set to light', function() it('can be set to light', function()
startup(true, false) startup(true, false)
screen:expect{condition=function() screen:expect{condition=function()
eq({rgb_fg=Screen.colors.White, rgb_bg=0, rgb_sp=Screen.colors.Red, eq({rgb_bg=Screen.colors.White, rgb_fg=0, rgb_sp=Screen.colors.Red,
cterm_bg=0, cterm_fg=0}, screen.default_colors) cterm_bg=0, cterm_fg=0}, screen.default_colors)
end} end}
end) end)

View File

@ -93,3 +93,6 @@ let $HOME = expand(getcwd() . '/XfakeHOME')
if !isdirectory($HOME) if !isdirectory($HOME)
call mkdir($HOME) call mkdir($HOME)
endif endif
" Use Vim's default color scheme
colorscheme vim

View File

@ -810,6 +810,7 @@ endfunc
" Test for :highlight command errors " Test for :highlight command errors
func Test_highlight_cmd_errors() func Test_highlight_cmd_errors()
if has('gui_running') || has('nvim') if has('gui_running') || has('nvim')
hi! Normal ctermfg=NONE ctermbg=NONE
" This test doesn't fail in the MS-Windows console version. " This test doesn't fail in the MS-Windows console version.
call assert_fails('hi Xcomment ctermfg=fg', 'E419:') call assert_fails('hi Xcomment ctermfg=fg', 'E419:')
call assert_fails('hi Xcomment ctermfg=bg', 'E420:') call assert_fails('hi Xcomment ctermfg=bg', 'E420:')

View File

@ -214,7 +214,7 @@ endfunc
func Test_echohl_completion() func Test_echohl_completion()
call feedkeys(":echohl no\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":echohl no\<C-A>\<C-B>\"\<CR>", 'tx')
" call assert_equal('"echohl NonText Normal none', @:) " call assert_equal('"echohl NonText Normal none', @:)
call assert_equal('"echohl NonText Normal NormalFloat none', @:) call assert_equal('"echohl NonText Normal NormalFloat NormalNC none', @:)
endfunc endfunc
func Test_syntax_arg_skipped() func Test_syntax_arg_skipped()