patch 8.2.3461: cannot distinguish Normal and Terminal-Normal mode
Problem: Cannot distinguish Normal and Terminal-Normal mode.
Solution: Make mode() return "nt" for Terminal-Normal mode. (issue #8856)
diff --git a/src/misc1.c b/src/misc1.c
index 1dd07f9..b4a4a8c 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -712,6 +712,10 @@
buf[1] = 'i';
buf[2] = restart_edit;
}
+#ifdef FEAT_TERMINAL
+ else if (term_in_normal_mode())
+ buf[1] = 't';
+#endif
}
// Clear out the minor mode when the argument is not a non-zero number or
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 9a4b597..e8762aa 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -874,6 +874,14 @@
call assert_equal('c-ce', g:current_modes)
" How to test Ex mode?
+ if has('terminal')
+ term
+ call feedkeys("\<C-W>N", 'xt')
+ call assert_equal('n', mode())
+ call assert_equal('nt', mode(1))
+ call feedkeys("aexit\<CR>", 'xt')
+ endif
+
bwipe!
iunmap <F2>
xunmap <F2>
diff --git a/src/version.c b/src/version.c
index 9331e34..57865cd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3461,
+/**/
3460,
/**/
3459,