diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-11-10 15:47:14 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-11-10 18:09:48 +0100 |
commit | 795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5 (patch) | |
tree | 187d5514db88a12a1067343043ad544402498bd2 /test/functional/ui/inccommand_spec.lua | |
parent | 2e1217da4617c832afcd7ca90c88b06c200dc23b (diff) | |
download | rneovim-795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5.tar.gz rneovim-795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5.tar.bz2 rneovim-795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5.zip |
'inccommand': Restore cursor/view if cancelled.
Restore cursor position and window "view", if command is cancelled.
This is how 'incsearch' works.
Diffstat (limited to 'test/functional/ui/inccommand_spec.lua')
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index de5f7411da..4eefb29b17 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -413,7 +413,7 @@ describe(":substitute, 'inccommand' preserves undo", function() insert("X") feed("IY<esc>") feed(":%s/tw/MO/<esc>") - -- using execute("undo") here will result in a "Press ENTER" prompt + -- execute("undo") here would cause "Press ENTER". feed("u") expect(default_text:gsub("Inc", "XInc")) feed("u") @@ -430,6 +430,7 @@ describe(":substitute, 'inccommand' preserves undo", function() if case == "split" then screen:expect([[ + Inc substitution on | ^MOo lines | | {15:~ }| @@ -438,7 +439,6 @@ describe(":substitute, 'inccommand' preserves undo", function() {15:~ }| {15:~ }| {15:~ }| - {15:~ }| Already...st change | ]]) else @@ -482,6 +482,7 @@ describe(":substitute, 'inccommand' preserves undo", function() if case == "split" then screen:expect([[ + Inc substitution on | two line^s | | {15:~ }| @@ -490,7 +491,6 @@ describe(":substitute, 'inccommand' preserves undo", function() {15:~ }| {15:~ }| {15:~ }| - {15:~ }| Already...st change | ]]) else @@ -522,6 +522,7 @@ describe(":substitute, 'inccommand' preserves undo", function() if case == "split" then screen:expect([[ + Inc substitution on | ^MOo lines | | {15:~ }| @@ -530,7 +531,6 @@ describe(":substitute, 'inccommand' preserves undo", function() {15:~ }| {15:~ }| {15:~ }| - {15:~ }| Already...st change | ]]) else @@ -564,6 +564,7 @@ describe(":substitute, 'inccommand' preserves undo", function() feed("u") if case == "split" then screen:expect([[ + Inc substitution on | ^MOo lines | | {15:~ }| @@ -572,7 +573,6 @@ describe(":substitute, 'inccommand' preserves undo", function() {15:~ }| {15:~ }| {15:~ }| - {15:~ }| Already...st change | ]]) else @@ -602,7 +602,8 @@ describe(":substitute, 'inccommand' preserves undo", function() if case == "split" then screen:expect([[ - ^two lines | + ^LInc substitution on| + two lines | | {15:~ }| {15:~ }| @@ -610,7 +611,6 @@ describe(":substitute, 'inccommand' preserves undo", function() {15:~ }| {15:~ }| {15:~ }| - {15:~ }| Already...st change | ]]) elseif case == "" then @@ -705,7 +705,7 @@ describe(":substitute, inccommand=split", function() ]]) end) - it('shows split window with empty replacement', function() + it('shows preview with empty replacement', function() feed(":%s/tw/") screen:expect([[ Inc substitution on | @@ -727,11 +727,11 @@ describe(":substitute, inccommand=split", function() feed("x") screen:expect([[ - xo lines | Inc substitution on | xo lines | | {15:~ }| + {15:~ }| {11:[No Name] [+] }| |2| {12:x}o lines | |4| {12:x}o lines | @@ -746,11 +746,11 @@ describe(":substitute, inccommand=split", function() feed("<bs>") screen:expect([[ - o lines | Inc substitution on | o lines | | {15:~ }| + {15:~ }| {11:[No Name] [+] }| |2| o lines | |4| o lines | @@ -768,11 +768,11 @@ describe(":substitute, inccommand=split", function() it('shows split window when typing replacement', function() feed(":%s/tw/XX") screen:expect([[ - XXo lines | Inc substitution on | XXo lines | | {15:~ }| + {15:~ }| {11:[No Name] [+] }| |2| {12:XX}o lines | |4| {12:XX}o lines | @@ -831,7 +831,7 @@ describe(":substitute, inccommand=split", function() ]]) end) - it('highlights the replacement text correctly', function() + it('highlights the replacement text', function() feed('ggO') feed('M M M<esc>') feed(':%s/M/123/g') @@ -855,9 +855,10 @@ describe(":substitute, inccommand=split", function() end) it('actually replaces text', function() - feed(":%s/tw/XX/g<enter>") + feed(":%s/tw/XX/g<Enter>") screen:expect([[ + Inc substitution on | XXo lines | Inc substitution on | ^XXo lines | @@ -871,7 +872,6 @@ describe(":substitute, inccommand=split", function() {15:~ }| {15:~ }| {15:~ }| - {15:~ }| :%s/tw/XX/g | ]]) end) @@ -884,11 +884,11 @@ describe(":substitute, inccommand=split", function() feed(":%s/tw/X") screen:expect([[ + Inc substitution on | BBo lines | Inc substitution on | Xo lines | Inc substitution on | - Xo lines | {11:[No Name] [+] }| |1001| {12:X}o lines | |1003| {12:X}o lines | @@ -922,13 +922,13 @@ describe(":substitute, inccommand=split", function() end) it('works with the n flag', function() - feed(":%s/tw/Mix/n<enter>") + feed(":%s/tw/Mix/n<Enter>") screen:expect([[ - ^two lines | Inc substitution on | two lines | - | - {15:~ }| + Inc substitution on | + two lines | + ^ | {15:~ }| {15:~ }| {15:~ }| @@ -1303,10 +1303,12 @@ describe("'inccommand' split windows", function() it('work after more splits', function() refresh() + feed("gg") execute("vsplit") execute("split") feed(":%s/tw") screen:expect([[ + Inc substitution on {10:|}Inc substitution on| two lines {10:|}two lines | {10:|} | {15:~ }{10:|}{15:~ }| @@ -1320,13 +1322,12 @@ describe("'inccommand' split windows", function() {15:~ }{10:|}{15:~ }| {15:~ }{10:|}{15:~ }| {15:~ }{10:|}{15:~ }| - {15:~ }{10:|}{15:~ }| {11:[No Name] [+] }{10:|}{15:~ }| + Inc substitution on {10:|}{15:~ }| two lines {10:|}{15:~ }| {10:|}{15:~ }| {15:~ }{10:|}{15:~ }| {15:~ }{10:|}{15:~ }| - {15:~ }{10:|}{15:~ }| {10:[No Name] [+] [No Name] [+] }| |2| two lines | | |