Skip to content

Commit 4132eb5

Browse files
committed
patch 8.2.0258: modifyOtherKeys cannot be temporarily disabled
Problem: ModifyOtherKeys cannot be temporarily disabled. Solution: Add echoraw() with an example for modifyOtherKeys.
1 parent 00f3b4e commit 4132eb5

5 files changed

Lines changed: 56 additions & 1 deletion

File tree

runtime/doc/eval.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.2. Last change: 2020 Feb 03
1+
*eval.txt* For Vim version 8.2. Last change: 2020 Feb 14
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2414,6 +2414,7 @@ deletebufline({expr}, {first} [, {last}])
24142414
did_filetype() Number |TRUE| if FileType autocmd event used
24152415
diff_filler({lnum}) Number diff filler lines about {lnum}
24162416
diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
2417+
echoraw({expr}) none output {expr} as-is
24172418
empty({expr}) Number |TRUE| if {expr} is empty
24182419
environ() Dict return environment variables
24192420
escape({string}, {chars}) String escape {chars} in {string} with '\'
@@ -2899,6 +2900,7 @@ win_id2win({expr}) Number get window nr from window ID
28992900
win_screenpos({nr}) List get screen position of window {nr}
29002901
win_splitmove({nr}, {target} [, {options}])
29012902
Number move window {nr} to split of {target}
2903+
win_type([{nr}]) String type of window {nr}
29022904
winbufnr({nr}) Number buffer number of window {nr}
29032905
wincol() Number window column of the cursor
29042906
winheight({nr}) Number height of window {nr}
@@ -3944,6 +3946,17 @@ diff_hlID({lnum}, {col}) *diff_hlID()*
39443946
Can also be used as a |method|: >
39453947
GetLnum()->diff_hlID(col)
39463948
3949+
3950+
echoraw({expr}) *echoraw()*
3951+
Output {expr} as-is, including unprintable characters. This
3952+
can be used to output a terminal code. For example, to disable
3953+
modifyOtherKeys: >
3954+
call echoraw(&t_TE)
3955+
< and to enable it again: >
3956+
call echoraw(&t_TI)
3957+
< Use with care, you can mess up the terminal this way.
3958+
3959+
39473960
empty({expr}) *empty()*
39483961
Return the Number 1 if {expr} is empty, zero otherwise.
39493962
- A |List| or |Dictionary| is empty when it does not have any
@@ -10402,6 +10415,7 @@ win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
1040210415
Can also be used as a |method|: >
1040310416
GetWinid()->win_splitmove(target)
1040410417
<
10418+
1040510419
*winbufnr()*
1040610420
winbufnr({nr}) The result is a Number, which is the number of the buffer
1040710421
associated with window {nr}. {nr} can be the window number or

src/evalfunc.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static void f_debugbreak(typval_T *argvars, typval_T *rettv);
6060
#endif
6161
static void f_deepcopy(typval_T *argvars, typval_T *rettv);
6262
static void f_did_filetype(typval_T *argvars, typval_T *rettv);
63+
static void f_echoraw(typval_T *argvars, typval_T *rettv);
6364
static void f_empty(typval_T *argvars, typval_T *rettv);
6465
static void f_environ(typval_T *argvars, typval_T *rettv);
6566
static void f_escape(typval_T *argvars, typval_T *rettv);
@@ -394,6 +395,7 @@ static funcentry_T global_functions[] =
394395
{"did_filetype", 0, 0, 0, &t_number, f_did_filetype},
395396
{"diff_filler", 1, 1, FEARG_1, &t_number, f_diff_filler},
396397
{"diff_hlID", 2, 2, FEARG_1, &t_number, f_diff_hlID},
398+
{"echoraw", 1, 1, FEARG_1, &t_number, f_echoraw},
397399
{"empty", 1, 1, FEARG_1, &t_number, f_empty},
398400
{"environ", 0, 0, 0, &t_dict_string, f_environ},
399401
{"escape", 2, 2, FEARG_1, &t_string, f_escape},
@@ -1813,6 +1815,21 @@ f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
18131815
rettv->vval.v_number = did_filetype;
18141816
}
18151817

1818+
/*
1819+
* "echoraw({expr})" function
1820+
*/
1821+
static void
1822+
f_echoraw(typval_T *argvars, typval_T *rettv UNUSED)
1823+
{
1824+
char_u *str = tv_get_string_chk(&argvars[0]);
1825+
1826+
if (str != NULL && *str != NUL)
1827+
{
1828+
out_str(str);
1829+
out_flush();
1830+
}
1831+
}
1832+
18161833
/*
18171834
* "empty({expr})" function
18181835
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
>x+0&#ffffff0|e|l@1|o| @34
2+
|~+0#4040ff13&| @38
3+
|~| @38
4+
|~| @38
5+
| +0#0000000&@21|0|,|0|-|1| @8|A|l@1|

src/testdir/test_functions.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
source shared.vim
33
source check.vim
44
source term_util.vim
5+
source screendump.vim
56

67
" Must be done first, since the alternate buffer must be unset.
78
func Test_00_bufexists()
@@ -2017,3 +2018,19 @@ func Test_range()
20172018
" uniq()
20182019
call assert_equal([0, 1, 2, 3, 4], uniq(range(5)))
20192020
endfunc
2021+
2022+
func Test_echoraw()
2023+
CheckScreendump
2024+
2025+
" Normally used for escape codes, but let's test with a CR.
2026+
let lines =<< trim END
2027+
call echoraw("hello\<CR>x")
2028+
END
2029+
call writefile(lines, 'XTest_echoraw')
2030+
let buf = RunVimInTerminal('-S XTest_echoraw', {'rows': 5, 'cols': 40})
2031+
call VerifyScreenDump(buf, 'Test_functions_echoraw', {})
2032+
2033+
" clean up
2034+
call StopVimInTerminal(buf)
2035+
call delete('XTest_echoraw')
2036+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
258,
745747
/**/
746748
257,
747749
/**/

0 commit comments

Comments
 (0)