From c01690b1eaa4ad55cea3ec48a0b5381180ebe970 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 13 Jul 2022 09:06:31 +0800 Subject: fix(exmode): flush messages before printing a line after pressing Enter (#19341) --- test/functional/legacy/ex_mode_spec.lua | 2 +- test/functional/ui/messages_spec.lua | 47 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) (limited to 'test/functional') diff --git a/test/functional/legacy/ex_mode_spec.lua b/test/functional/legacy/ex_mode_spec.lua index e4469d53ed..98f113bbd0 100644 --- a/test/functional/legacy/ex_mode_spec.lua +++ b/test/functional/legacy/ex_mode_spec.lua @@ -104,10 +104,10 @@ describe('Ex mode', function() -- Pressing enter in ex mode should print the current line feed('') screen:expect([[ - {1: 1 }foo foo | ^^^y | {1: 2 }foo foo | ^^^q | + {1: 2 }foo foo | {1: 3 }foo foo | :^ | ]]) diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index e9c0e1b2a1..00f126a1f2 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -1196,6 +1196,53 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim {4:Press ENTER or type command to continue}^ | ]]} end) + + it('prints lines in Ex mode correctly with a burst of carriage returns #19341', function() + command('set number') + meths.buf_set_lines(0, 0, 0, true, {'aaa', 'bbb', 'ccc'}) + command('set display-=msgsep') + feed('gggQ1vi') + screen:expect([[ + Entering Ex mode. Type "visual" to go to Normal mode. | + {11: 2 }bbb | + {11: 3 }ccc | + :1 | + {11: 1 }aaa | + {11: 2 }bbb | + :vi^ | + ]]) + feed('') + screen:expect([[ + {11: 1 }aaa | + {11: 2 }^bbb | + {11: 3 }ccc | + {11: 4 } | + {1:~ }| + {1:~ }| + | + ]]) + command('set display+=msgsep') + feed('gggQ1vi') + screen:expect([[ + Entering Ex mode. Type "visual" to go to Normal mode. | + {11: 2 }bbb | + {11: 3 }ccc | + :1 | + {11: 1 }aaa | + {11: 2 }bbb | + :vi^ | + ]]) + feed('') + screen:expect([[ + {11: 1 }aaa | + {11: 2 }^bbb | + {11: 3 }ccc | + {11: 4 } | + {1:~ }| + {1:~ }| + | + ]]) + end) end) describe('ui/ext_messages', function() -- cgit