fix(ui2): only highlight Ex command lines in the cmdline #38182

Problem:  Prompts and message text (in block mode) in the cmdline are
          parsed and highlighted as if it is Vimscript.
          Entering the cmdline while it is expanded can work more like
          it does with UI1, where the press enter prompt is replaced
          and previous messages stay on the message grid, while
          subsequent messages are placed below it.
Solution: Highlight manually with string parser on lines starting with ':'.
          Spoof cmdline block mode when the cmdline is entered while it
          is expanded.
This commit is contained in:
luukvbaal
2026-03-06 19:29:20 +01:00
committed by GitHub
parent ac6cf5b03b
commit 301c7065ca
4 changed files with 74 additions and 51 deletions

View File

@@ -78,17 +78,17 @@ describe('cmdline2', function()
{1:~ }|*9
{16::}{15:if} {26:1} |
{16::} {15:echo} {26:"foo"} |
{15:foo} |
foo |
{16::} ^ |
]])
feed([[echo input("foo\nbar:")<CR>]])
screen:expect([[
|
{1:~ }|*7
:if 1 |
: echo "foo" |
{16::}{15:if} {26:1} |
{16::} {15:echo} {26:"foo"} |
foo |
: echo input("foo\nbar:") |
{16::} {15:echo} {25:input}{16:(}{26:"foo\nbar:"}{16:)} |
foo |
bar:^ |
]])
@@ -96,10 +96,10 @@ describe('cmdline2', function()
screen:expect([[
|
{1:~ }|*7
:if 1 |
: echo "foo" |
{16::}{15:if} {26:1} |
{16::} {15:echo} {26:"foo"} |
foo |
: echo input("foo\nbar:") |
{16::} {15:echo} {25:input}{16:(}{26:"foo\nbar:"}{16:)} |
foo |
bar:baz^ |
]])
@@ -109,11 +109,11 @@ describe('cmdline2', function()
{1:~ }|*5
{16::}{15:if} {26:1} |
{16::} {15:echo} {26:"foo"} |
{15:foo} |
foo |
{16::} {15:echo} {25:input}{16:(}{26:"foo\nbar:"}{16:)} |
{15:foo} |
{15:bar}:baz |
{15:baz} |
foo |
bar:baz |
baz |
{16::} ^ |
]])
feed('endif')
@@ -122,11 +122,11 @@ describe('cmdline2', function()
{1:~ }|*5
{16::}{15:if} {26:1} |
{16::} {15:echo} {26:"foo"} |
{15:foo} |
foo |
{16::} {15:echo} {25:input}{16:(}{26:"foo\nbar:"}{16:)} |
{15:foo} |
{15:bar}:baz |
{15:baz} |
foo |
bar:baz |
baz |
{16::} {15:endif}^ |
]])
feed('<CR>')
@@ -178,7 +178,7 @@ describe('cmdline2', function()
screen:expect([[
{10:f}oo |
{1:~ }|*12
{16::}{15:s}{16:/f}^ |
{16::}{15:s}{16:/f^ } |
]])
end)