• R/O
  • SSH

vim: Commit

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


Commit MetaInfo

Revisão658248b68f7c82671cb6849e195339410b130a99 (tree)
Hora2020-04-02 02:30:04
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Mensagem de Log

patch 8.2.0491: cannot recognize a <script> mapping using maparg()

Commit: https://github.com/vim/vim/commit/2da0f0c445da3c9b35b2a0cd595d10e81ad2a6f9
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 1 19:22:12 2020 +0200

patch 8.2.0491: cannot recognize a <script> mapping using maparg()
Problem: Cannot recognize a <script> mapping using maparg().
Solution: Add the "script" key. (closes https://github.com/vim/vim/issues/5873)

Mudança Sumário

Diff

diff -r 8c8c7c532424 -r 658248b68f7c runtime/doc/eval.txt
--- a/runtime/doc/eval.txt Wed Apr 01 18:30:04 2020 +0200
+++ b/runtime/doc/eval.txt Wed Apr 01 19:30:04 2020 +0200
@@ -6824,6 +6824,7 @@
68246824 "rhs" The {rhs} of the mapping as typed.
68256825 "silent" 1 for a |:map-silent| mapping, else 0.
68266826 "noremap" 1 if the {rhs} of the mapping is not remappable.
6827+ "script" 1 if mapping was defined with <script>.
68276828 "expr" 1 for an expression mapping (|:map-<expr>|).
68286829 "buffer" 1 for a buffer local mapping (|:map-local|).
68296830 "mode" Modes for which the mapping is defined. In
diff -r 8c8c7c532424 -r 658248b68f7c src/map.c
--- a/src/map.c Wed Apr 01 18:30:04 2020 +0200
+++ b/src/map.c Wed Apr 01 19:30:04 2020 +0200
@@ -2200,6 +2200,8 @@
22002200 dict_add_string(dict, "lhs", lhs);
22012201 dict_add_string(dict, "rhs", mp->m_orig_str);
22022202 dict_add_number(dict, "noremap", mp->m_noremap ? 1L : 0L);
2203+ dict_add_number(dict, "script", mp->m_noremap == REMAP_SCRIPT
2204+ ? 1L : 0L);
22032205 dict_add_number(dict, "expr", mp->m_expr ? 1L : 0L);
22042206 dict_add_number(dict, "silent", mp->m_silent ? 1L : 0L);
22052207 dict_add_number(dict, "sid", (long)mp->m_script_ctx.sc_sid);
diff -r 8c8c7c532424 -r 658248b68f7c src/testdir/test_maparg.vim
--- a/src/testdir/test_maparg.vim Wed Apr 01 18:30:04 2020 +0200
+++ b/src/testdir/test_maparg.vim Wed Apr 01 19:30:04 2020 +0200
@@ -16,23 +16,23 @@
1616 map foo<C-V> is<F4>foo
1717 vnoremap <script> <buffer> <expr> <silent> bar isbar
1818 call assert_equal("is<F4>foo", maparg('foo<C-V>'))
19- call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo<C-V>',
19+ call assert_equal({'silent': 0, 'noremap': 0, 'script': 0, 'lhs': 'foo<C-V>',
2020 \ 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': sid, 'lnum': lnum + 1,
2121 \ 'rhs': 'is<F4>foo', 'buffer': 0},
2222 \ maparg('foo<C-V>', '', 0, 1))
23- call assert_equal({'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v',
23+ call assert_equal({'silent': 1, 'noremap': 1, 'script': 1, 'lhs': 'bar', 'mode': 'v',
2424 \ 'nowait': 0, 'expr': 1, 'sid': sid, 'lnum': lnum + 2,
2525 \ 'rhs': 'isbar', 'buffer': 1},
2626 \ 'bar'->maparg('', 0, 1))
2727 let lnum = expand('<sflnum>')
2828 map <buffer> <nowait> foo bar
29- call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ',
29+ call assert_equal({'silent': 0, 'noremap': 0, 'script': 0, 'lhs': 'foo', 'mode': ' ',
3030 \ 'nowait': 1, 'expr': 0, 'sid': sid, 'lnum': lnum + 1, 'rhs': 'bar',
3131 \ 'buffer': 1},
3232 \ maparg('foo', '', 0, 1))
3333 let lnum = expand('<sflnum>')
3434 tmap baz foo
35- call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'baz', 'mode': 't',
35+ call assert_equal({'silent': 0, 'noremap': 0, 'script': 0, 'lhs': 'baz', 'mode': 't',
3636 \ 'nowait': 0, 'expr': 0, 'sid': sid, 'lnum': lnum + 1, 'rhs': 'foo',
3737 \ 'buffer': 0},
3838 \ maparg('baz', 't', 0, 1))
diff -r 8c8c7c532424 -r 658248b68f7c src/version.c
--- a/src/version.c Wed Apr 01 18:30:04 2020 +0200
+++ b/src/version.c Wed Apr 01 19:30:04 2020 +0200
@@ -739,6 +739,8 @@
739739 static int included_patches[] =
740740 { /* Add new patch number below this line */
741741 /**/
742+ 491,
743+/**/
742744 490,
743745 /**/
744746 489,
Show on old repository browser