mirror of
https://github.com/neovim/neovim.git
synced 2026-02-20 01:09:56 +10:00
refactor(tests): allow to extend the new base set of attrs
We start at 100 so we can make the base set larger if needed. (It might need to grow/shrink as a result of adopting the new default color scheme as the default for tests) Usage best illustrataded by example. Improving the workflow for making new tests with `screen:snapshot_util()` will be a follow up.
This commit is contained in:
@@ -255,6 +255,17 @@ function Screen:set_default_attr_ids(attr_ids)
|
||||
self._default_attr_ids = attr_ids
|
||||
end
|
||||
|
||||
function Screen:add_extra_attr_ids(extra_attr_ids)
|
||||
local attr_ids = vim.deepcopy(Screen._global_default_attr_ids)
|
||||
for id, attr in pairs(extra_attr_ids) do
|
||||
if type(id) == 'number' and id < 100 then
|
||||
error('extra attr ids should be at least 100 or be strings')
|
||||
end
|
||||
attr_ids[id] = attr
|
||||
end
|
||||
self._default_attr_ids = attr_ids
|
||||
end
|
||||
|
||||
function Screen:get_default_attr_ids()
|
||||
return deepcopy(self._default_attr_ids)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user