• R/O
  • SSH

vim: コミット

Mirror of the Vim source from https://github.com/vim/vim


コミットメタ情報

リビジョンbd9069d21c5d3933c9fcef14b2b18e764c8fe0ff (tree)
日時2020-02-15 01:00:04
作者Bram Moolenaar <Bram@vim....>
コミッターBram Moolenaar

ログメッセージ

patch 8.2.0258: modifyOtherKeys cannot be temporarily disabled

Commit: https://github.com/vim/vim/commit/4132eb505c506f7a0710b03a275d1c5a247e4196
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 14 16:53:00 2020 +0100

patch 8.2.0258: modifyOtherKeys cannot be temporarily disabled
Problem: ModifyOtherKeys cannot be temporarily disabled.
Solution: Add echoraw() with an example for modifyOtherKeys.

変更サマリ

差分

diff -r 99feeb1a4af7 -r bd9069d21c5d runtime/doc/eval.txt
--- a/runtime/doc/eval.txt Fri Feb 14 14:45:05 2020 +0100
+++ b/runtime/doc/eval.txt Fri Feb 14 17:00:04 2020 +0100
@@ -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 @@
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 @@
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 @@
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 @@
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
diff -r 99feeb1a4af7 -r bd9069d21c5d src/evalfunc.c
--- a/src/evalfunc.c Fri Feb 14 14:45:05 2020 +0100
+++ b/src/evalfunc.c Fri Feb 14 17:00:04 2020 +0100
@@ -60,6 +60,7 @@
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 @@
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},
@@ -1814,6 +1816,21 @@
18141816 }
18151817
18161818 /*
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+
1833+/*
18171834 * "empty({expr})" function
18181835 */
18191836 static void
diff -r 99feeb1a4af7 -r bd9069d21c5d src/testdir/dumps/Test_functions_echoraw.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_functions_echoraw.dump Fri Feb 14 17:00:04 2020 +0100
@@ -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|
diff -r 99feeb1a4af7 -r bd9069d21c5d src/testdir/test_functions.vim
--- a/src/testdir/test_functions.vim Fri Feb 14 14:45:05 2020 +0100
+++ b/src/testdir/test_functions.vim Fri Feb 14 17:00:04 2020 +0100
@@ -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 @@
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
diff -r 99feeb1a4af7 -r bd9069d21c5d src/version.c
--- a/src/version.c Fri Feb 14 14:45:05 2020 +0100
+++ b/src/version.c Fri Feb 14 17:00:04 2020 +0100
@@ -743,6 +743,8 @@
743743 static int included_patches[] =
744744 { /* Add new patch number below this line */
745745 /**/
746+ 258,
747+/**/
746748 257,
747749 /**/
748750 256,
旧リポジトリブラウザで表示