Patch 8.2.0258
Problem: ModifyOtherKeys cannot be temporarily disabled.
Solution: Add echoraw() with an example for modifyOtherKeys.
Files: runtime/doc/eval.txt, src/evalfunc.c,
src/testdir/test_functions.vim,
src/testdir/dumps/Test_functions_echoraw.dump
*** ../vim-8.2.0257/runtime/doc/eval.txt 2020-02-14 14:32:15.962616361 +0100
--- runtime/doc/eval.txt 2020-02-14 14:47:45.031087575 +0100
***************
*** 2412,2417 ****
--- 2414,2420 ----
did_filetype() Number |TRUE| if FileType autocmd event used
diff_filler({lnum}) Number diff filler lines about {lnum}
diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
+ echoraw({expr}) none output {expr} as-is
empty({expr}) Number |TRUE| if {expr} is empty
environ() Dict return environment variables
escape({string}, {chars}) String escape {chars} in {string} with '\'
***************
*** 3941,3953 ****
Can also be used as a |method|: >
GetLnum()->diff_hlID(col)
! environ() *environ()*
! Return all of environment variables as dictionary. You can
! check if an environment variable exists like this: >
! :echo has_key(environ(), 'HOME')
! < Note that the variable name may be CamelCase; to ignore case
! use this: >
! :echo index(keys(environ()), 'HOME', 0, 1) != -1
empty({expr}) *empty()*
Return the Number 1 if {expr} is empty, zero otherwise.
--- 3945,3961 ----
Can also be used as a |method|: >
GetLnum()->diff_hlID(col)
!
!
! echoraw({expr}) *echoraw()*
! Output {expr} as-is, including unprintable characters. This
! can be used to output a terminal code. For example, to disable
! modifyOtherKeys: >
! call echoraw(&t_TE)
! < and to enable it again: >
! call echoraw(&t_TI)
! < Use with care, you can mess up the terminal this way.
!
empty({expr}) *empty()*
Return the Number 1 if {expr} is empty, zero otherwise.
***************
*** 3966,3971 ****
--- 3974,3987 ----
Can also be used as a |method|: >
mylist->empty()
+ environ() *environ()*
+ Return all of environment variables as dictionary. You can
+ check if an environment variable exists like this: >
+ :echo has_key(environ(), 'HOME')
+ < Note that the variable name may be CamelCase; to ignore case
+ use this: >
+ :echo index(keys(environ()), 'HOME', 0, 1) != -1
+
escape({string}, {chars}) *escape()*
Escape the characters in {chars} that occur in {string} with a
backslash. Example: >
*** ../vim-8.2.0257/src/evalfunc.c 2020-02-14 14:32:15.962616361 +0100
--- src/evalfunc.c 2020-02-14 14:53:07.745695010 +0100
***************
*** 60,65 ****
--- 60,66 ----
#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,399 ****
--- 395,401 ----
{"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,1819 ****
--- 1816,1836 ----
}
/*
+ * "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
*** ../vim-8.2.0257/src/testdir/test_functions.vim 2020-02-05 20:10:30.639158668 +0100
--- src/testdir/test_functions.vim 2020-02-14 16:48:08.912388672 +0100
***************
*** 2,7 ****
--- 2,8 ----
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,2019 ****
--- 2018,2036 ----
" 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
*** ../vim-8.2.0257/src/testdir/dumps/Test_functions_echoraw.dump 2020-02-14 16:50:47.975756082 +0100
--- src/testdir/dumps/Test_functions_echoraw.dump 2020-02-14 16:48:16.384358966 +0100
***************
*** 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|
*** ../vim-8.2.0257/src/version.c 2020-02-14 14:32:15.966616351 +0100
--- src/version.c 2020-02-14 14:50:03.702449344 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 258,
/**/
--
If your nose runs, and your feet smell, you might be upside down.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///