ui: use line-based rather than char-based updates in screen.c

Add ext_newgrid and ext_hlstate extensions. These use predefined
highlights and line-segment based updates, for efficiency and
simplicity.. The ext_hlstate extension in addition allows semantic
identification of builtin and syntax highlights.

Reimplement the old char-based updates in the remote UI layer, for
compatibility. For the moment, this is still the default. The bulitin
TUI uses the new line-based protocol.

cmdline uses curwin cursor position when ext_cmdline is active.
This commit is contained in:
Björn Linse
2018-07-06 14:39:50 +02:00
parent 2134396074
commit 1adb01c120
28 changed files with 979 additions and 576 deletions

View File

@@ -29,6 +29,9 @@ describe('external cmdline', function()
if name == "cmdline_show" then
local content, pos, firstc, prompt, indent, level = unpack(data)
ok(level > 0)
for _,item in ipairs(content) do
item[1] = screen:get_hl(item[1])
end
cmdline[level] = {content=content, pos=pos, firstc=firstc,
prompt=prompt, indent=indent}
last_level = level
@@ -87,6 +90,7 @@ describe('external cmdline', function()
|
]], nil, nil, function()
eq(1, last_level)
--print(require('inspect')(cmdline))
eq({{
content = { { {}, "" } },
firstc = ":",
@@ -168,10 +172,10 @@ describe('external cmdline', function()
it('from normal mode', function()
feed(':')
screen:expect([[
|
^ |
{1:~ }|
{1:~ }|
{3:c^ }|
{3:c }|
|
]], nil, nil, function()
eq({{
@@ -351,11 +355,11 @@ describe('external cmdline', function()
-- redraw! forgets cursor position. Be OK with that, as UI should indicate
-- focus is at external cmdline anyway.
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
^ |
{1:~ }|
{1:~ }|
{1:~ }|
|
]], nil, nil, function()
eq(expectation, cmdline)
end)
@@ -363,11 +367,11 @@ describe('external cmdline', function()
feed('<cr>')
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
^ |
{1:~ }|
{1:~ }|
{1:~ }|
|
]], nil, nil, function()
eq({{
content = { { {}, "xx3" } },
@@ -424,11 +428,11 @@ describe('external cmdline', function()
block = {}
command("redraw!")
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
^ |
{1:~ }|
{1:~ }|
{1:~ }|
|
]], nil, nil, function()
eq({ { { {}, 'function Foo()'} },
{ { {}, ' line1'} } }, block)
@@ -528,9 +532,9 @@ describe('external cmdline', function()
screen:expect([[
|
{2:[No Name] }|
{1::}make |
{1::}make^ |
{3:[Command Line] }|
^ |
|
]], nil, nil, function()
eq({nil, {
content = { { {}, "yank" } },
@@ -572,11 +576,11 @@ describe('external cmdline', function()
cmdline = {}
command("redraw!")
screen:expect([[
|
{1:~ }|
{1:~ }|
{1:~ }|
^ |
{1:~ }|
{1:~ }|
{1:~ }|
|
]], nil, nil, function()
eq({{
content = { { {}, "make" } },