comparison src/testdir/test_terminal.vim @ 12457:dfb8254aa735 v8.0.1108

patch 8.0.1108: cannot specify mappings for the terminal window commit https://github.com/vim/vim/commit/69fbc9e1dab176f345719436cd89d854df0a2abd Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 14 20:37:57 2017 +0200 patch 8.0.1108: cannot specify mappings for the terminal window Problem: Cannot specify mappings for the terminal window. Solution: Add the :tmap command and associated code. (Jacob Askeland, closes #2073)
author Christian Brabandt <cb@256bit.org>
date Thu, 14 Sep 2017 20:45:05 +0200
parents 4ae1485b5834
children 27c5d8954231
comparison
equal deleted inserted replaced
12456:bc590831aac5 12457:dfb8254aa735
618 call WaitFor('job_status(g:job) == "dead"') 618 call WaitFor('job_status(g:job) == "dead"')
619 bwipe 619 bwipe
620 call delete('Xfile') 620 call delete('Xfile')
621 endif 621 endif
622 endfunc 622 endfunc
623
624 func TerminalTmap(remap)
625 let buf = Run_shell_in_terminal({})
626 call assert_equal('t', mode())
627
628 if a:remap
629 tmap 123 456
630 else
631 tnoremap 123 456
632 endif
633 tmap 456 abcde
634 call assert_equal('456', maparg('123', 't'))
635 call assert_equal('abcde', maparg('456', 't'))
636 call feedkeys("123", 'tx')
637 call term_wait(buf)
638 let lnum = term_getcursor(buf)[0]
639 if a:remap
640 call assert_match('abcde', term_getline(buf, lnum))
641 else
642 call assert_match('456', term_getline(buf, lnum))
643 endif
644
645 call term_sendkeys(buf, "\r")
646 call Stop_shell_in_terminal(buf)
647 call term_wait(buf)
648
649 tunmap 123
650 tunmap 456
651 call assert_equal('', maparg('123', 't'))
652 close
653 unlet g:job
654 endfunc
655
656 func Test_terminal_tmap()
657 call TerminalTmap(1)
658 call TerminalTmap(0)
659 endfunc