changeset 17522:e17cbc3e545d v8.1.1759

patch 8.1.1759: no mode char for terminal mapping from maparg() commit https://github.com/vim/vim/commit/14371ed69778107654e39268d0d90982e53ad6e0 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 27 21:05:21 2019 +0200 patch 8.1.1759: no mode char for terminal mapping from maparg() Problem: No mode char for terminal mapping from maparg(). Solution: Check for TERMINAL mode. (closes https://github.com/vim/vim/issues/4735)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Jul 2019 21:15:05 +0200
parents 759cc01b28b5
children 80252a3e2550
files src/getchar.c src/testdir/test_maparg.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4009,6 +4009,8 @@ map_mode_to_chars(int mode)
 	    ga_append(&mapmode, 'n');			/* :nmap */
 	if (mode & OP_PENDING)
 	    ga_append(&mapmode, 'o');			/* :omap */
+	if (mode & TERMINAL)
+	    ga_append(&mapmode, 't');			/* :tmap */
 	if ((mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
 	    ga_append(&mapmode, 'v');			/* :vmap */
 	else
--- a/src/testdir/test_maparg.vim
+++ b/src/testdir/test_maparg.vim
@@ -29,6 +29,12 @@ function Test_maparg()
         \ 'nowait': 1, 'expr': 0, 'sid': sid, 'lnum': lnum + 1, 'rhs': 'bar',
 	\ 'buffer': 1},
         \ maparg('foo', '', 0, 1))
+  let lnum = expand('<sflnum>')
+  tmap baz foo
+  call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'baz', 'mode': 't',
+        \ 'nowait': 0, 'expr': 0, 'sid': sid, 'lnum': lnum + 1, 'rhs': 'foo',
+	\ 'buffer': 0},
+        \ maparg('baz', 't', 0, 1))
 
   map abc x<char-114>x
   call assert_equal("xrx", maparg('abc'))
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1759,
+/**/
     1758,
 /**/
     1757,