2024-04-09 04:26:16 -07:00
|
|
|
local t = require('test.functional.testutil')()
|
2014-12-08 18:31:45 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-08 02:03:20 -07:00
|
|
|
local spawn, set_session, clear = t.spawn, t.set_session, t.clear
|
|
|
|
local feed, command = t.feed, t.command
|
|
|
|
local insert = t.insert
|
|
|
|
local eq = t.eq
|
|
|
|
local fn, api = t.fn, t.api
|
2016-08-15 16:42:12 -07:00
|
|
|
|
2017-04-24 17:17:15 -07:00
|
|
|
describe('screen', function()
|
2015-06-20 14:45:03 -07:00
|
|
|
local screen
|
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.
2023-11-29 13:16:09 -07:00
|
|
|
local nvim_argv = {
|
2024-04-08 02:03:20 -07:00
|
|
|
t.nvim_prog,
|
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.
2023-11-29 13:16:09 -07:00
|
|
|
'-u',
|
|
|
|
'NONE',
|
|
|
|
'-i',
|
|
|
|
'NONE',
|
test: 'nofsync' with deadly signal #26415
Problem:
The test for 'nofsync' swapfile preservation on a deadly signal, does
not actually assert anything.
followup to 1fd29a28841dee3d25ff079eb24fc160eb02cb3c
Solution:
Check that swapfile contents are present after getting SIGTERM.
TODO: this doesn't really verify that 'fsync' was called; it still
passes with this patch:
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 216e39f3e81c..7a635520401d 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -838,7 +838,7 @@ void preserve_exit(const char *errmsg)
if (errmsg != NULL) {
os_errmsg("Vim: preserving files...\r\n");
}
- ml_sync_all(false, false, true); // preserve all swap files
+ ml_sync_all(false, false, false); // preserve all swap files
break;
}
}
However it correctly fails with this patch, at least:
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 216e39f3e81c..f2306c310ddc 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -838,7 +838,6 @@ void preserve_exit(const char *errmsg)
if (errmsg != NULL) {
os_errmsg("Vim: preserving files...\r\n");
}
- ml_sync_all(false, false, true); // preserve all swap files
break;
}
}
2023-12-06 08:11:36 -07:00
|
|
|
'-n',
|
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.
2023-11-29 13:16:09 -07:00
|
|
|
'--cmd',
|
|
|
|
'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler',
|
|
|
|
'--cmd',
|
|
|
|
'colorscheme vim',
|
|
|
|
'--embed',
|
|
|
|
}
|
2015-06-20 14:45:03 -07:00
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
local screen_nvim = spawn(nvim_argv)
|
|
|
|
set_session(screen_nvim)
|
|
|
|
screen = Screen.new()
|
|
|
|
screen:attach()
|
|
|
|
end)
|
|
|
|
|
2017-04-24 17:17:15 -07:00
|
|
|
it('default initial screen', function()
|
2023-12-09 05:42:00 -07:00
|
|
|
screen:expect([[
|
2015-06-20 14:45:03 -07:00
|
|
|
^ |
|
2024-03-26 13:23:36 -07:00
|
|
|
{1:~ }|*11
|
|
|
|
{3:[No Name] }|
|
2015-06-20 14:45:03 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2018-09-28 05:19:37 -07:00
|
|
|
local function screen_tests(linegrid)
|
2014-12-08 18:31:45 -07:00
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new()
|
2018-09-28 05:19:37 -07:00
|
|
|
screen:attach({ rgb = true, ext_linegrid = linegrid })
|
2016-08-09 06:04:43 -07:00
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[0] = { bold = true, foreground = 255 },
|
|
|
|
[1] = { bold = true, reverse = true },
|
|
|
|
[2] = { bold = true },
|
|
|
|
[3] = { reverse = true },
|
|
|
|
[4] = { background = Screen.colors.LightGrey, underline = true },
|
|
|
|
[5] = {
|
|
|
|
background = Screen.colors.LightGrey,
|
|
|
|
underline = true,
|
|
|
|
bold = true,
|
|
|
|
foreground = Screen.colors.Fuchsia,
|
|
|
|
},
|
|
|
|
[6] = { bold = true, foreground = Screen.colors.Fuchsia },
|
|
|
|
[7] = { bold = true, foreground = Screen.colors.SeaGreen },
|
2023-02-12 02:32:49 -07:00
|
|
|
[8] = { foreground = Screen.colors.White, background = Screen.colors.Red },
|
2016-08-09 06:04:43 -07:00
|
|
|
})
|
2014-12-08 18:31:45 -07:00
|
|
|
end)
|
|
|
|
|
2015-01-15 05:01:25 -07:00
|
|
|
describe('bell/visual bell', function()
|
|
|
|
it('is forwarded to the UI', function()
|
|
|
|
feed('<left>')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(true, screen.bell)
|
|
|
|
eq(false, screen.visual_bell)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
screen.bell = false
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set visualbell')
|
2015-01-15 05:01:25 -07:00
|
|
|
feed('<left>')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(true, screen.visual_bell)
|
|
|
|
eq(false, screen.bell)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe(':set title', function()
|
|
|
|
it('is forwarded to the UI', function()
|
|
|
|
local expected = 'test-title'
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set titlestring=' .. expected)
|
|
|
|
command('set title')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.title)
|
2015-07-23 12:07:51 -07:00
|
|
|
end)
|
2023-05-10 19:48:48 -07:00
|
|
|
screen:detach()
|
|
|
|
screen.title = nil
|
|
|
|
screen:attach()
|
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.title)
|
|
|
|
end)
|
2015-07-23 12:07:51 -07:00
|
|
|
end)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
describe(':set icon', function()
|
|
|
|
it('is forwarded to the UI', function()
|
|
|
|
local expected = 'test-icon'
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set iconstring=' .. expected)
|
|
|
|
command('set icon')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.icon)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
2023-05-10 19:48:48 -07:00
|
|
|
screen:detach()
|
|
|
|
screen.icon = nil
|
|
|
|
screen:attach()
|
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.icon)
|
|
|
|
end)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2018-12-05 02:50:38 -07:00
|
|
|
describe('statusline', function()
|
|
|
|
it('is redrawn after <c-l>', function()
|
|
|
|
command('set laststatus=2')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2018-12-05 02:50:38 -07:00
|
|
|
{1:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<c-l>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2018-12-05 02:50:38 -07:00
|
|
|
{1:[No Name] }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
reset = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
command('split')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2018-12-05 02:50:38 -07:00
|
|
|
{1:[No Name] }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2018-12-05 02:50:38 -07:00
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<c-l>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2018-12-05 02:50:38 -07:00
|
|
|
{1:[No Name] }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2018-12-05 02:50:38 -07:00
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
reset = true,
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
describe('window', function()
|
|
|
|
describe('split', function()
|
|
|
|
it('horizontal', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] }|
|
2017-04-08 17:02:52 -07:00
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('horizontal and resize', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('resize 8')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*7
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] }|
|
2017-04-08 17:02:52 -07:00
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('horizontal and vertical', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('vsp')
|
|
|
|
command('vsp')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
^ │ │ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }│{0:~ }│{0:~ }|*5
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] }{3:[No Name] [No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
insert('hello')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
hell^o │hello │hello |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }│{0:~ }│{0:~ }|*5
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
hello |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2018-05-03 11:53:45 -07:00
|
|
|
describe('tabs', function()
|
|
|
|
it('tabnew creates a new buffer', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('vsp')
|
|
|
|
command('vsp')
|
2014-12-08 18:31:45 -07:00
|
|
|
insert('hello')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
hell^o │hello │hello |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }│{0:~ }│{0:~ }|*5
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
hello |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command('tabnew')
|
2014-12-08 18:31:45 -07:00
|
|
|
insert('hello2')
|
|
|
|
feed('h')
|
|
|
|
screen:expect([[
|
2016-08-09 06:04:43 -07:00
|
|
|
{4: }{5:4}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
|
2015-03-05 02:07:55 -07:00
|
|
|
hell^o2 |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command('tabprevious')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2016-08-09 06:04:43 -07:00
|
|
|
{2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
|
2022-05-15 09:34:44 -07:00
|
|
|
hell^o │hello │hello |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }│{0:~ }│{0:~ }|*5
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
hello |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2018-05-03 11:53:45 -07:00
|
|
|
|
|
|
|
it('tabline is redrawn after messages', function()
|
|
|
|
command('tabnew')
|
|
|
|
screen:expect([[
|
|
|
|
{4: [No Name] }{2: [No Name] }{3: }{4:X}|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2018-05-03 11:53:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed(':echo "' .. string.rep('x\\n', 11) .. '"<cr>')
|
|
|
|
screen:expect([[
|
|
|
|
{1: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
x |*11
|
2018-05-03 11:53:45 -07:00
|
|
|
|
|
|
|
|
{7:Press ENTER or type command to continue}^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<cr>')
|
|
|
|
screen:expect([[
|
|
|
|
{4: [No Name] }{2: [No Name] }{3: }{4:X}|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2018-05-03 11:53:45 -07:00
|
|
|
|
|
|
|
|
]])
|
2018-07-23 12:08:36 -07:00
|
|
|
|
|
|
|
feed(':echo "' .. string.rep('x\\n', 12) .. '"<cr>')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
x |*12
|
2018-07-23 12:08:36 -07:00
|
|
|
|
|
|
|
|
{7:Press ENTER or type command to continue}^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<cr>')
|
|
|
|
screen:expect([[
|
|
|
|
{4: [No Name] }{2: [No Name] }{3: }{4:X}|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2018-07-23 12:08:36 -07:00
|
|
|
|
|
|
|
|
]])
|
2018-05-03 11:53:45 -07:00
|
|
|
end)
|
2018-07-24 04:12:54 -07:00
|
|
|
|
|
|
|
it('redraws properly with :tab split right after scroll', function()
|
2017-06-26 05:49:15 -07:00
|
|
|
feed('15Ofoo<esc>15Obar<esc>gg')
|
2018-07-24 04:12:54 -07:00
|
|
|
|
|
|
|
command('vsplit')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
^foo │foo |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo │foo |*11
|
2018-07-24 04:12:54 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<PageDown>')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
^foo │foo |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo │foo |*3
|
|
|
|
bar │foo |*8
|
2018-07-24 04:12:54 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('tab split')
|
|
|
|
screen:expect([[
|
|
|
|
{4: }{5:2}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
|
|
|
|
^foo |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo |*3
|
|
|
|
bar |*8
|
2018-07-24 04:12:54 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2018-10-25 08:40:24 -07:00
|
|
|
|
|
|
|
it('redraws unvisited tab #9152', function()
|
|
|
|
insert('hello')
|
|
|
|
-- create a tab without visiting it
|
|
|
|
command('tabnew|tabnext')
|
|
|
|
screen:expect([[
|
|
|
|
{2: + [No Name] }{4: [No Name] }{3: }{4:X}|
|
|
|
|
hell^o |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2018-10-25 08:40:24 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('gT')
|
|
|
|
screen:expect([[
|
|
|
|
{4: + [No Name] }{2: [No Name] }{3: }{4:X}|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2018-10-25 08:40:24 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2014-12-08 18:31:45 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
describe('insert mode', function()
|
|
|
|
it('move to next line with <cr>', function()
|
|
|
|
feed('iline 1<cr>line 2<cr>')
|
|
|
|
screen:expect([[
|
|
|
|
line 1 |
|
|
|
|
line 2 |
|
2015-03-05 02:07:55 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*10
|
2016-08-09 06:04:43 -07:00
|
|
|
{2:-- INSERT --} |
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2015-04-27 19:08:14 -07:00
|
|
|
describe('normal mode', function()
|
|
|
|
-- https://code.google.com/p/vim/issues/detail?id=339
|
|
|
|
it("setting 'ruler' doesn't reset the preferred column", function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set virtualedit=')
|
2015-04-27 19:08:14 -07:00
|
|
|
feed('i0123456<cr>789<esc>kllj')
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set ruler')
|
2015-04-27 19:08:14 -07:00
|
|
|
feed('k')
|
|
|
|
screen:expect([[
|
|
|
|
0123^456 |
|
|
|
|
789 |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*11
|
2017-04-08 17:02:52 -07:00
|
|
|
1,5 All |
|
2015-04-27 19:08:14 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
describe('command mode', function()
|
|
|
|
it('typing commands', function()
|
|
|
|
feed(':ls')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*12
|
2015-03-05 02:07:55 -07:00
|
|
|
:ls^ |
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2022-09-27 07:19:15 -07:00
|
|
|
it('execute command with multi-line output', function()
|
2018-03-31 02:12:27 -07:00
|
|
|
feed(':ls<cr>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*9
|
2018-03-31 02:12:27 -07:00
|
|
|
{1: }|
|
|
|
|
:ls |
|
|
|
|
1 %a "[No Name]" line 1 |
|
|
|
|
{7:Press ENTER or type command to continue}^ |
|
|
|
|
]])
|
|
|
|
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
|
|
|
|
end)
|
2014-12-08 18:31:45 -07:00
|
|
|
end)
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
describe('scrolling and clearing', function()
|
|
|
|
before_each(function()
|
|
|
|
insert([[
|
|
|
|
Inserting
|
|
|
|
text
|
|
|
|
with
|
|
|
|
many
|
|
|
|
lines
|
|
|
|
to
|
|
|
|
test
|
|
|
|
scrolling
|
|
|
|
and
|
|
|
|
clearing
|
|
|
|
in
|
|
|
|
split
|
|
|
|
windows
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('vsp')
|
|
|
|
command('vsp')
|
2015-01-15 05:01:25 -07:00
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
and │and │and |
|
|
|
|
clearing │clearing │clearing |
|
|
|
|
in │in │in |
|
|
|
|
split │split │split |
|
|
|
|
windows │windows │windows |
|
|
|
|
^ │ │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('only affects the current scroll region', function()
|
|
|
|
feed('6k')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
^scrolling │and │and |
|
|
|
|
and │clearing │clearing |
|
|
|
|
clearing │in │in |
|
|
|
|
in │split │split |
|
|
|
|
split │windows │windows |
|
|
|
|
windows │ │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('<c-w>l')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
scrolling │and │and |
|
|
|
|
and │clearing │clearing |
|
|
|
|
clearing │in │in |
|
|
|
|
in │split │split |
|
|
|
|
split │windows │windows |
|
|
|
|
windows │^ │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('gg')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
scrolling │^Inserting │and |
|
|
|
|
and │text │clearing |
|
|
|
|
clearing │with │in |
|
|
|
|
in │many │split |
|
|
|
|
split │lines │windows |
|
|
|
|
windows │to │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('7j')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
scrolling │with │and |
|
|
|
|
and │many │clearing |
|
|
|
|
clearing │lines │in |
|
|
|
|
in │to │split |
|
|
|
|
split │test │windows |
|
|
|
|
windows │^scrolling │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('2j')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
scrolling │lines │and |
|
|
|
|
and │to │clearing |
|
|
|
|
clearing │test │in |
|
|
|
|
in │scrolling │split |
|
|
|
|
split │and │windows |
|
|
|
|
windows │^clearing │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('5k')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
scrolling │^lines │and |
|
|
|
|
and │to │clearing |
|
|
|
|
clearing │test │in |
|
|
|
|
in │scrolling │split |
|
|
|
|
split │and │windows |
|
|
|
|
windows │clearing │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('k')
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
scrolling │^many │and |
|
|
|
|
and │lines │clearing |
|
|
|
|
clearing │to │in |
|
|
|
|
in │test │split |
|
|
|
|
split │scrolling │windows |
|
|
|
|
windows │and │ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('resize', function()
|
2023-02-12 02:32:49 -07:00
|
|
|
it('rebuilds the whole screen', function()
|
2015-01-15 05:01:25 -07:00
|
|
|
screen:try_resize(25, 5)
|
|
|
|
feed('iresize')
|
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
resize^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2016-08-09 06:04:43 -07:00
|
|
|
{2:-- INSERT --} |
|
2015-01-15 05:01:25 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2017-01-18 05:53:10 -07:00
|
|
|
it('has minimum width/height values', function()
|
2023-02-12 02:32:49 -07:00
|
|
|
feed('iresize')
|
2015-01-15 05:01:25 -07:00
|
|
|
screen:try_resize(1, 1)
|
|
|
|
screen:expect([[
|
2018-07-11 05:48:22 -07:00
|
|
|
resize^ |
|
2023-09-30 01:31:55 -07:00
|
|
|
{2:-- INSERT --}|
|
2015-01-15 05:01:25 -07:00
|
|
|
]])
|
2018-07-11 05:48:22 -07:00
|
|
|
|
2015-01-15 05:01:25 -07:00
|
|
|
feed('<esc>:ls')
|
|
|
|
screen:expect([[
|
|
|
|
resize |
|
2015-03-05 02:07:55 -07:00
|
|
|
:ls^ |
|
2015-01-15 05:01:25 -07:00
|
|
|
]])
|
|
|
|
end)
|
2022-10-21 16:53:39 -07:00
|
|
|
|
|
|
|
it('VimResized autocommand does not cause invalid UI events #20692 #20759', function()
|
2023-02-12 02:32:49 -07:00
|
|
|
screen:try_resize(25, 5)
|
|
|
|
feed('iresize<Esc>')
|
2022-10-21 16:53:39 -07:00
|
|
|
command([[autocmd VimResized * redrawtabline]])
|
|
|
|
command([[autocmd VimResized * lua vim.api.nvim_echo({ { 'Hello' } }, false, {})]])
|
|
|
|
command([[autocmd VimResized * let g:echospace = v:echospace]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('showtabline', 2, {})
|
2022-10-21 16:53:39 -07:00
|
|
|
screen:expect([[
|
|
|
|
{2: + [No Name] }{3: }|
|
|
|
|
resiz^e |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2022-10-21 16:53:39 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
screen:try_resize(30, 6)
|
|
|
|
screen:expect([[
|
|
|
|
{2: + [No Name] }{3: }|
|
|
|
|
resiz^e |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2022-10-21 16:53:39 -07:00
|
|
|
|
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(29, api.nvim_get_var('echospace'))
|
2022-10-21 16:53:39 -07:00
|
|
|
end)
|
2023-02-12 02:32:49 -07:00
|
|
|
|
|
|
|
it('messages from the same Ex command as resize are visible #22225', function()
|
|
|
|
feed(':set columns=20 | call<CR>')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
|*9
|
2023-02-12 02:32:49 -07:00
|
|
|
{1: }|
|
|
|
|
{8:E471: Argument requi}|
|
|
|
|
{8:red} |
|
|
|
|
{7:Press ENTER or type }|
|
|
|
|
{7:command to continue}^ |
|
|
|
|
]])
|
|
|
|
feed('<CR>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*12
|
2023-02-12 02:32:49 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed(':set columns=0<CR>')
|
|
|
|
screen:expect([[
|
2023-12-22 21:56:58 -07:00
|
|
|
|
|
|
|
|
{0:~ }|*7
|
|
|
|
{1: }|
|
|
|
|
{8:E594: Need at least }|
|
|
|
|
{8:12 columns: columns=}|
|
|
|
|
{8:0} |
|
|
|
|
{7:Press ENTER or type }|
|
|
|
|
{7:command to continue}^ |
|
2023-02-12 02:32:49 -07:00
|
|
|
]])
|
|
|
|
feed('<CR>')
|
|
|
|
screen:expect([[
|
2023-12-22 21:56:58 -07:00
|
|
|
^ |
|
|
|
|
{0:~ }|*12
|
|
|
|
|
|
2023-02-12 02:32:49 -07:00
|
|
|
]])
|
|
|
|
end)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
2017-05-09 04:31:19 -07:00
|
|
|
|
|
|
|
describe('press enter', function()
|
|
|
|
it('does not crash on <F1> at “Press ENTER”', function()
|
|
|
|
command('nnoremap <F1> :echo "TEST"<CR>')
|
|
|
|
feed(':ls<CR>')
|
|
|
|
screen:expect([[
|
2018-03-31 02:12:27 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*9
|
2018-03-31 02:12:27 -07:00
|
|
|
{1: }|
|
2017-05-09 04:31:19 -07:00
|
|
|
:ls |
|
|
|
|
1 %a "[No Name]" line 1 |
|
|
|
|
{7:Press ENTER or type command to continue}^ |
|
|
|
|
]])
|
|
|
|
feed('<F1>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*12
|
2017-05-09 04:31:19 -07:00
|
|
|
TEST |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
2018-05-04 10:10:45 -07:00
|
|
|
|
|
|
|
-- Regression test for #8357
|
|
|
|
it('does not have artifacts after temporary chars in insert mode', function()
|
2019-09-25 22:37:51 -07:00
|
|
|
command('set timeoutlen=10000')
|
2018-05-04 10:10:45 -07:00
|
|
|
command('inoremap jk <esc>')
|
|
|
|
feed('ifooj')
|
|
|
|
screen:expect([[
|
|
|
|
foo^j |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*12
|
2018-05-04 10:10:45 -07:00
|
|
|
{2:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
feed('k')
|
|
|
|
screen:expect([[
|
|
|
|
fo^o |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*12
|
2018-05-04 10:10:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2018-07-06 05:39:50 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
describe('Screen (char-based)', function()
|
|
|
|
screen_tests(false)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('Screen (line-based)', function()
|
|
|
|
screen_tests(true)
|
2017-04-24 17:17:15 -07:00
|
|
|
end)
|
2019-02-05 08:17:23 -07:00
|
|
|
|
|
|
|
describe('Screen default colors', function()
|
|
|
|
local screen
|
|
|
|
local function startup(light, termcolors)
|
|
|
|
local extra = (light and ' background=light') or ''
|
|
|
|
|
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.
2023-11-29 13:16:09 -07:00
|
|
|
local nvim_argv = {
|
2024-04-08 02:03:20 -07:00
|
|
|
t.nvim_prog,
|
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.
2023-11-29 13:16:09 -07:00
|
|
|
'-u',
|
|
|
|
'NONE',
|
|
|
|
'-i',
|
|
|
|
'NONE',
|
|
|
|
'-N',
|
|
|
|
'--cmd',
|
|
|
|
'set shortmess+=I noswapfile belloff= noshowcmd noruler' .. extra,
|
|
|
|
'--cmd',
|
|
|
|
'colorscheme vim',
|
|
|
|
'--embed',
|
|
|
|
}
|
2019-02-05 08:17:23 -07:00
|
|
|
local screen_nvim = spawn(nvim_argv)
|
|
|
|
set_session(screen_nvim)
|
|
|
|
screen = Screen.new()
|
|
|
|
screen:attach(termcolors and { rgb = true, ext_termcolors = true } or { rgb = true })
|
|
|
|
end
|
|
|
|
|
|
|
|
it('are dark per default', function()
|
|
|
|
startup(false, false)
|
|
|
|
screen:expect {
|
|
|
|
condition = function()
|
|
|
|
eq({
|
|
|
|
rgb_bg = 0,
|
|
|
|
rgb_fg = Screen.colors.White,
|
|
|
|
rgb_sp = Screen.colors.Red,
|
|
|
|
cterm_bg = 0,
|
|
|
|
cterm_fg = 0,
|
|
|
|
}, screen.default_colors)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can be set to light', function()
|
|
|
|
startup(true, false)
|
|
|
|
screen:expect {
|
|
|
|
condition = function()
|
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.
2023-11-29 13:16:09 -07:00
|
|
|
eq({
|
|
|
|
rgb_bg = Screen.colors.White,
|
|
|
|
rgb_fg = 0,
|
|
|
|
rgb_sp = Screen.colors.Red,
|
2019-02-05 08:17:23 -07:00
|
|
|
cterm_bg = 0,
|
|
|
|
cterm_fg = 0,
|
|
|
|
}, screen.default_colors)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can be handled by external terminal', function()
|
|
|
|
startup(false, true)
|
|
|
|
screen:expect {
|
|
|
|
condition = function()
|
|
|
|
eq(
|
|
|
|
{ rgb_bg = -1, rgb_fg = -1, rgb_sp = -1, cterm_bg = 0, cterm_fg = 0 },
|
|
|
|
screen.default_colors
|
|
|
|
)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
startup(true, true)
|
|
|
|
screen:expect {
|
|
|
|
condition = function()
|
|
|
|
eq(
|
|
|
|
{ rgb_bg = -1, rgb_fg = -1, rgb_sp = -1, cterm_bg = 0, cterm_fg = 0 },
|
|
|
|
screen.default_colors
|
|
|
|
)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
end)
|
2022-10-11 20:35:47 -07:00
|
|
|
|
|
|
|
it('CTRL-F or CTRL-B scrolls a page after UI attach/resize #20605', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(100, 100)
|
|
|
|
screen:attach()
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(100, api.nvim_get_option_value('lines', {}))
|
|
|
|
eq(99, api.nvim_get_option_value('window', {}))
|
|
|
|
eq(99, api.nvim_win_get_height(0))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('1000o<Esc>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(903, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-B>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(806, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-B>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(709, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-F>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(806, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-F>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(903, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('G')
|
|
|
|
screen:try_resize(50, 50)
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(50, api.nvim_get_option_value('lines', {}))
|
|
|
|
eq(49, api.nvim_get_option_value('window', {}))
|
|
|
|
eq(49, api.nvim_win_get_height(0))
|
|
|
|
eq(953, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-B>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(906, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-B>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(859, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-F>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(906, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
feed('<C-F>')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(953, fn.line('w0'))
|
2022-10-11 20:35:47 -07:00
|
|
|
end)
|
2023-06-03 19:49:02 -07:00
|
|
|
|
|
|
|
it("showcmd doesn't cause empty grid_line with redrawdebug=compositor #22593", function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(30, 2)
|
|
|
|
screen:attach()
|
|
|
|
command('set showcmd redrawdebug=compositor')
|
|
|
|
feed('d')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
|
|
|
d |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|