From 7d183e89f7c055c8f5217e91294123a5aa0a5e2d Mon Sep 17 00:00:00 2001 From: Drew Neil Date: Thu, 25 May 2017 10:11:34 +0100 Subject: [PATCH 1/5] Use Normal mode as default when opening a new terminal --- src/nvim/ex_docmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6e7938046a..d1405978b3 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -9835,7 +9835,7 @@ static void ex_terminal(exarg_T *eap) if (*eap->arg != NUL) { // Run {cmd} in 'shell'. char *name = (char *)vim_strsave_escaped(eap->arg, (char_u *)"\"\\"); snprintf(ex_cmd, sizeof(ex_cmd), - ":enew%s | call termopen(\"%s\") | startinsert", + ":enew%s | call termopen(\"%s\")", eap->forceit ? "!" : "", name); xfree(name); } else { // No {cmd}: run the job with tokenized 'shell'. @@ -9857,7 +9857,7 @@ static void ex_terminal(exarg_T *eap) shell_free_argv(argv); snprintf(ex_cmd, sizeof(ex_cmd), - ":enew%s | call termopen([%s]) | startinsert", + ":enew%s | call termopen([%s])", eap->forceit ? "!" : "", shell_argv + 1); } From 5a214a9ed01cf004a229cbb82cf5474662e35b5b Mon Sep 17 00:00:00 2001 From: Drew Neil Date: Thu, 25 May 2017 11:49:11 +0100 Subject: [PATCH 2/5] Update documentation --- runtime/doc/various.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index f06c062ee3..223a0135b2 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -212,7 +212,6 @@ g8 Print the hex values of the bytes used in the Equivalent to: > :enew :call termopen('{cmd}') - :startinsert < See |termopen()|. From 642e14d9e7d946d1ebd4395f9c9497926c0df2f3 Mon Sep 17 00:00:00 2001 From: Drew Neil Date: Thu, 25 May 2017 11:27:56 +0100 Subject: [PATCH 3/5] Repair ex_terminal_spec functional tests --- test/functional/terminal/ex_terminal_spec.lua | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 9930efc402..7522f073c4 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -72,10 +72,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell() wait() screen:expect([[ - ready $ | + ^ready $ | [Process exited 0] | | - -- TERMINAL -- | + :terminal | ]]) end) @@ -96,10 +96,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell() wait() screen:expect([[ - jeff $ | + ^jeff $ | [Process exited 0] | | - -- TERMINAL -- | + :terminal | ]]) end) @@ -107,10 +107,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell('echo hi') wait() screen:expect([[ - ready $ echo hi | + ^ready $ echo hi | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo hi | ]]) end) @@ -119,10 +119,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell('echo hi') wait() screen:expect([[ - jeff $ echo hi | + ^jeff $ echo hi | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo hi | ]]) end) @@ -130,10 +130,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell([[echo 'hello' \ "world"]]) wait() screen:expect([[ - ready $ echo 'hello' \ "world" | + ^ready $ echo 'hello' \ "world" | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo 'hello' \ "world" | ]]) end) @@ -166,10 +166,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell() wait() screen:expect([[ - ready $ | + ^ready $ | [Process exited 0] | | - -- TERMINAL -- | + :terminal | ]]) eq('term://', string.match(eval('bufname("%")'), "^term://")) helpers.feed([[]]) @@ -184,10 +184,10 @@ describe(':terminal (with fake shell)', function() it('works with gf', function() terminal_with_fake_shell([[echo "scripts/shadacat.py"]]) screen:expect([[ - ready $ echo "scripts/shadacat.py" | + ^ready $ echo "scripts/shadacat.py" | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo "scripts/shadacat.py" | ]]) helpers.feed([[]]) eq('term://', string.match(eval('bufname("%")'), "^term://")) From ac529478382fc16c02f9d341925029c972cef455 Mon Sep 17 00:00:00 2001 From: Drew Neil Date: Thu, 25 May 2017 11:35:27 +0100 Subject: [PATCH 4/5] Repair job_spec functional tests --- test/functional/core/job_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 54e56f7f41..1b8a5b1b95 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -677,12 +677,12 @@ describe("pty process teardown", function() -- Exiting should terminate all descendants (PTY, its children, ...). screen:expect([[ - | + ^ | [Process exited 0] | | | | - -- TERMINAL -- | + | ]]) end) end) From 73286a81cfd92f334dcfa91490648fd105696fab Mon Sep 17 00:00:00 2001 From: Drew Neil Date: Thu, 25 May 2017 11:40:55 +0100 Subject: [PATCH 5/5] Repair tui_spec functional tests --- test/functional/terminal/tui_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 21b907c8f7..34a5ac0a49 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -287,8 +287,8 @@ describe('tui focus event handling', function() feed_data(':terminal\n') feed_data('\027[I') screen:expect([[ - ready $ | - [Process exited 0]{1: } | + {1:r}eady $ | + [Process exited 0] | | | | @@ -297,8 +297,8 @@ describe('tui focus event handling', function() ]]) feed_data('\027[O') screen:expect([[ - ready $ | - [Process exited 0]{1: } | + {1:r}eady $ | + [Process exited 0] | | | |