summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1189
blob: 11af372fa1530907630d4d2a398ef87e9da93bc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1189
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1189
Problem:    Mode is not cleared when leaving Insert mode.
Solution:   Clear the mode when got_int is set. (Ozaki Kiichi, closes #4270)
Files:	    src/edit.c, src/testdir/test_bufline.vim,
            src/testdir/test_messages.vim


*** ../vim-8.1.1188/src/edit.c	2019-03-30 18:46:57.344077426 +0100
--- src/edit.c	2019-04-20 14:55:19.719612597 +0200
***************
*** 4564,4570 ****
       */
      if (reg_recording != 0 || restart_edit != NUL)
  	showmode();
!     else if (p_smd && !skip_showmode())
  	msg("");
  
      return TRUE;	    /* exit Insert mode */
--- 4564,4570 ----
       */
      if (reg_recording != 0 || restart_edit != NUL)
  	showmode();
!     else if (p_smd && (got_int || !skip_showmode()))
  	msg("");
  
      return TRUE;	    /* exit Insert mode */
*** ../vim-8.1.1188/src/testdir/test_bufline.vim	2018-09-21 16:59:40.113489779 +0200
--- src/testdir/test_bufline.vim	2019-04-20 14:55:19.719612597 +0200
***************
*** 18,24 ****
    let b = bufnr('%')
    wincmd w
    call assert_equal(1, setbufline(b, 5, ['x']))
!   call assert_equal(1, setbufline(1234, 1, ['x']))
    call assert_equal(0, setbufline(b, 4, ['d', 'e']))
    call assert_equal(['c'], getbufline(b, 3))
    call assert_equal(['d'], getbufline(b, 4))
--- 18,24 ----
    let b = bufnr('%')
    wincmd w
    call assert_equal(1, setbufline(b, 5, ['x']))
!   call assert_equal(1, setbufline(bufnr('$') + 1, 1, ['x']))
    call assert_equal(0, setbufline(b, 4, ['d', 'e']))
    call assert_equal(['c'], getbufline(b, 3))
    call assert_equal(['d'], getbufline(b, 4))
*** ../vim-8.1.1188/src/testdir/test_messages.vim	2019-01-09 23:00:58.001176090 +0100
--- src/testdir/test_messages.vim	2019-04-20 14:55:19.719612597 +0200
***************
*** 1,5 ****
--- 1,7 ----
  " Tests for :messages, :echomsg, :echoerr
  
+ source shared.vim
+ 
  function Test_messages()
    let oldmore = &more
    try
***************
*** 92,94 ****
--- 94,127 ----
    call assert_match("function('<lambda>\\d*')", execute(':echoerr {-> 1234}'))
    call test_ignore_error('RESET')
  endfunc
+ 
+ func Test_mode_message_at_leaving_insert_by_ctrl_c()
+   if !has('terminal') || has('gui_running')
+     return
+   endif
+ 
+   " Set custom statusline built by user-defined function.
+   let testfile = 'Xtest.vim'
+   call writefile([
+         \ 'func StatusLine() abort',
+         \ '  return ""',
+         \ 'endfunc',
+         \ 'set statusline=%!StatusLine()',
+         \ 'set laststatus=2',
+         \ ], testfile)
+ 
+   let rows = 10
+   let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
+   call term_wait(buf, 200)
+   call assert_equal('run', job_status(term_getjob(buf)))
+ 
+   call term_sendkeys(buf, "i")
+   call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))})
+   call term_sendkeys(buf, "\<C-C>")
+   call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))})
+ 
+   call term_sendkeys(buf, ":qall!\<CR>")
+   call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
+   exe buf . 'bwipe!'
+   call delete(testfile)
+ endfunc
*** ../vim-8.1.1188/src/version.c	2019-04-20 14:39:42.796386124 +0200
--- src/version.c	2019-04-20 15:06:03.740022909 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1189,
  /**/

-- 
Experience is what you get when you don't get what you want.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///