summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0696
blob: 82202943b662e00b29fcf2a028b07ca9c8f518e5 (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0696
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.0696
Problem:    When test_edit fails 'insertmode' may not be reset and the next
            test may get stuck. (James McCoy)
Solution:   Always reset 'insertmode' after executing a test.  Avoid that an
            InsertCharPre autocommand or a 'complete' function can change the
            state. (closes #3768)
Files:	    src/testdir/runtest.vim, src/edit.c


*** ../vim-8.1.0695/src/testdir/runtest.vim	2018-12-15 17:46:18.909870746 +0100
--- src/testdir/runtest.vim	2019-01-06 15:23:08.248156368 +0100
***************
*** 26,32 ****
  " It will be called after each Test_ function.
  "
  " When debugging a test it can be useful to add messages to v:errors:
! " 	call add(v:errors, "this happened")
  
  
  " Without the +eval feature we can't run these tests, bail out.
--- 26,32 ----
  " It will be called after each Test_ function.
  "
  " When debugging a test it can be useful to add messages to v:errors:
! "	call add(v:errors, "this happened")
  
  
  " Without the +eval feature we can't run these tests, bail out.
***************
*** 149,154 ****
--- 149,158 ----
      endtry
    endif
  
+   " In case 'insertmode' was set and something went wrong, make sure it is
+   " reset to avoid trouble with anything else.
+   set noinsertmode
+ 
    if exists("*TearDown")
      try
        call TearDown()
*** ../vim-8.1.0695/src/edit.c	2019-01-02 23:47:14.360433274 +0100
--- src/edit.c	2019-01-06 15:21:36.636912346 +0100
***************
*** 4219,4224 ****
--- 4219,4225 ----
      win_T	*curwin_save;
      buf_T	*curbuf_save;
      typval_T	rettv;
+     int		save_State = State;
  
      funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
      if (*funcname == NUL)
***************
*** 4272,4277 ****
--- 4273,4281 ----
  	ins_compl_add_dict(matchdict);
  
  theend:
+     // Restore State, it might have been changed.
+     State = save_State;
+ 
      if (matchdict != NULL)
  	dict_unref(matchdict);
      if (matchlist != NULL)
***************
*** 5549,5554 ****
--- 5553,5559 ----
  	    pos_T	pos;
  	    win_T	*curwin_save;
  	    buf_T	*curbuf_save;
+ 	    int		save_State = State;
  
  	    /* Call 'completefunc' or 'omnifunc' and get pattern length as a
  	     * string */
***************
*** 5572,5577 ****
--- 5577,5584 ----
  	    curwin_save = curwin;
  	    curbuf_save = curbuf;
  	    col = call_func_retnr(funcname, 2, args);
+ 
+ 	    State = save_State;
  	    if (curwin_save != curwin || curbuf_save != curbuf)
  	    {
  		EMSG(_(e_complwin));
***************
*** 10730,10735 ****
--- 10737,10743 ----
  {
      char_u	*res;
      char_u	buf[MB_MAXBYTES + 1];
+     int		save_State = State;
  
      /* Return quickly when there is nothing to do. */
      if (!has_insertcharpre())
***************
*** 10762,10767 ****
--- 10770,10778 ----
      set_vim_var_string(VV_CHAR, NULL, -1);  /* clear v:char */
      --textlock;
  
+     // Restore the State, it may have been changed.
+     State = save_State;
+ 
      return res;
  }
  #endif
*** ../vim-8.1.0695/src/version.c	2019-01-06 13:10:46.332499076 +0100
--- src/version.c	2019-01-06 14:27:17.537077362 +0100
***************
*** 801,802 ****
--- 801,804 ----
  {   /* Add new patch number below this line */
+ /**/
+     696,
  /**/

-- 
Corduroy pillows: They're making headlines!

 /// 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    ///