mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 14:58:18 +00:00

This is the first installment of a multi-PR series significantly refactoring how highlights are being specified. The end goal is to have a base set of 20 ish most common highlights, and then specific files only need to add more groups to that as needed. As a complicating factor, we also want to migrate to the new default color scheme eventually. But by sharing a base set, that future PR will hopefully be a lot smaller since a lot of tests will be migrated just simply by updating the base set in place. As a first step, fix the anti-pattern than Screen defaults to ignoring highlights. Highlights are integral part of the screen state, not something "extra" which we only test "sometimes". For now, we still allow opt-out via the intentionally ugly screen._default_attr_ids = nil The end goal is to get rid of all of these eventually (which will be easier as part of the color scheme migration)
100 lines
3.5 KiB
Lua
100 lines
3.5 KiB
Lua
local helpers = require('test.functional.helpers')(after_each)
|
|
local Screen = require('test.functional.ui.screen')
|
|
local clear = helpers.clear
|
|
local exec_lua = helpers.exec_lua
|
|
local api = helpers.api
|
|
local source = helpers.source
|
|
local eq = helpers.eq
|
|
|
|
local function sizeoflong()
|
|
if not exec_lua('return pcall(require, "ffi")') then
|
|
pending('missing LuaJIT FFI')
|
|
end
|
|
return exec_lua('return require("ffi").sizeof(require("ffi").typeof("long"))')
|
|
end
|
|
|
|
describe('put', function()
|
|
before_each(clear)
|
|
after_each(function()
|
|
eq({}, api.nvim_get_vvar('errors'))
|
|
end)
|
|
|
|
it('very large count 64-bit', function()
|
|
if sizeoflong() < 8 then
|
|
pending('Skipped: only works with 64 bit long ints')
|
|
end
|
|
|
|
source [[
|
|
new
|
|
let @" = repeat('x', 100)
|
|
call assert_fails('norm 999999999p', 'E1240:')
|
|
bwipe!
|
|
]]
|
|
end)
|
|
|
|
it('very large count (visual block) 64-bit', function()
|
|
if sizeoflong() < 8 then
|
|
pending('Skipped: only works with 64 bit long ints')
|
|
end
|
|
|
|
source [[
|
|
new
|
|
call setline(1, repeat('x', 100))
|
|
exe "norm \<C-V>$y"
|
|
call assert_fails('norm 999999999p', 'E1240:')
|
|
bwipe!
|
|
]]
|
|
end)
|
|
|
|
-- oldtest: Test_put_other_window()
|
|
it('above topline in buffer in two splits', function()
|
|
local screen = Screen.new(80, 10)
|
|
screen:attach()
|
|
source([[
|
|
40vsplit
|
|
0put ='some text at the top'
|
|
put =' one more text'
|
|
put =' two more text'
|
|
put =' three more text'
|
|
put =' four more text'
|
|
]])
|
|
|
|
screen:expect([[
|
|
some text at the top │some text at the top |
|
|
one more text │ one more text |
|
|
two more text │ two more text |
|
|
three more text │ three more text |
|
|
^four more text │ four more text |
|
|
│ |
|
|
{1:~ }│{1:~ }|*2
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
]])
|
|
end)
|
|
|
|
-- oldtest: Test_put_in_last_displayed_line()
|
|
it('in last displayed line', function()
|
|
local screen = Screen.new(75, 10)
|
|
screen:attach()
|
|
source([[
|
|
autocmd CursorMoved * eval line('w$')
|
|
let @a = 'x'->repeat(&columns * 2 - 2)
|
|
eval range(&lines)->setline(1)
|
|
call feedkeys('G"ap')
|
|
]])
|
|
|
|
screen:expect([[
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx^x |
|
|
|
|
|
]])
|
|
end)
|
|
end)
|