summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-14 16:53:00 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-14 16:53:00 +0100
commit4132eb505c506f7a0710b03a275d1c5a247e4196 (patch)
treef93229200c03e39d4afea6e2586e4e38a0d26ac5 /src
parent00f3b4e007af07870168bf044cecc9d544483953 (diff)
downloadvim-git-4132eb505c506f7a0710b03a275d1c5a247e4196.tar.gz
patch 8.2.0258: modifyOtherKeys cannot be temporarily disabledv8.2.0258
Problem: ModifyOtherKeys cannot be temporarily disabled. Solution: Add echoraw() with an example for modifyOtherKeys.
Diffstat (limited to 'src')
-rw-r--r--src/evalfunc.c17
-rw-r--r--src/testdir/dumps/Test_functions_echoraw.dump5
-rw-r--r--src/testdir/test_functions.vim17
-rw-r--r--src/version.c2
4 files changed, 41 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index a0f29943e..3e1a462d1 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -60,6 +60,7 @@ static void f_debugbreak(typval_T *argvars, typval_T *rettv);
#endif
static void f_deepcopy(typval_T *argvars, typval_T *rettv);
static void f_did_filetype(typval_T *argvars, typval_T *rettv);
+static void f_echoraw(typval_T *argvars, typval_T *rettv);
static void f_empty(typval_T *argvars, typval_T *rettv);
static void f_environ(typval_T *argvars, typval_T *rettv);
static void f_escape(typval_T *argvars, typval_T *rettv);
@@ -394,6 +395,7 @@ static funcentry_T global_functions[] =
{"did_filetype", 0, 0, 0, &t_number, f_did_filetype},
{"diff_filler", 1, 1, FEARG_1, &t_number, f_diff_filler},
{"diff_hlID", 2, 2, FEARG_1, &t_number, f_diff_hlID},
+ {"echoraw", 1, 1, FEARG_1, &t_number, f_echoraw},
{"empty", 1, 1, FEARG_1, &t_number, f_empty},
{"environ", 0, 0, 0, &t_dict_string, f_environ},
{"escape", 2, 2, FEARG_1, &t_string, f_escape},
@@ -1814,6 +1816,21 @@ f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
}
/*
+ * "echoraw({expr})" function
+ */
+ static void
+f_echoraw(typval_T *argvars, typval_T *rettv UNUSED)
+{
+ char_u *str = tv_get_string_chk(&argvars[0]);
+
+ if (str != NULL && *str != NUL)
+ {
+ out_str(str);
+ out_flush();
+ }
+}
+
+/*
* "empty({expr})" function
*/
static void
diff --git a/src/testdir/dumps/Test_functions_echoraw.dump b/src/testdir/dumps/Test_functions_echoraw.dump
new file mode 100644
index 000000000..f27cd0325
--- /dev/null
+++ b/src/testdir/dumps/Test_functions_echoraw.dump
@@ -0,0 +1,5 @@
+>x+0&#ffffff0|e|l@1|o| @34
+|~+0#4040ff13&| @38
+|~| @38
+|~| @38
+| +0#0000000&@21|0|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 9173e8547..c74885476 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2,6 +2,7 @@
source shared.vim
source check.vim
source term_util.vim
+source screendump.vim
" Must be done first, since the alternate buffer must be unset.
func Test_00_bufexists()
@@ -2017,3 +2018,19 @@ func Test_range()
" uniq()
call assert_equal([0, 1, 2, 3, 4], uniq(range(5)))
endfunc
+
+func Test_echoraw()
+ CheckScreendump
+
+ " Normally used for escape codes, but let's test with a CR.
+ let lines =<< trim END
+ call echoraw("hello\<CR>x")
+ END
+ call writefile(lines, 'XTest_echoraw')
+ let buf = RunVimInTerminal('-S XTest_echoraw', {'rows': 5, 'cols': 40})
+ call VerifyScreenDump(buf, 'Test_functions_echoraw', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XTest_echoraw')
+endfunc
diff --git a/src/version.c b/src/version.c
index 70ea449a3..2720dc652 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 258,
+/**/
257,
/**/
256,