summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0042
blob: ad8f947cfbb5d0f9568cfd63db90270c1d0d8db5 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0042
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.0042
Problem:    If omni completion opens a window Insert mode is stopped.
            (Hirohito Higashi)
Solution:   Only set stop_insert_mode in a prompt buffer window.
Files:      src/window.c


*** ../vim-8.1.0041/src/window.c	2018-06-06 18:02:31.402773772 +0200
--- src/window.c	2018-06-10 14:33:03.071395777 +0200
***************
*** 2107,2123 ****
      static void
  leaving_window(win_T *win)
  {
      // When leaving a prompt window stop Insert mode and perhaps restart
      // it when entering that window again.
      win->w_buffer->b_prompt_insert = restart_edit;
      restart_edit = NUL;
  
      // When leaving the window (or closing the window) was done from a
!     // callback we need to break out of the Insert mode loop.
      if (State & INSERT)
      {
  	stop_insert_mode = TRUE;
! 	if (bt_prompt(win->w_buffer) && win->w_buffer->b_prompt_insert == NUL)
  	    win->w_buffer->b_prompt_insert = 'A';
      }
  }
--- 2107,2128 ----
      static void
  leaving_window(win_T *win)
  {
+     // Only matters for a prompt window.
+     if (!bt_prompt(win->w_buffer))
+ 	return;
+ 
      // When leaving a prompt window stop Insert mode and perhaps restart
      // it when entering that window again.
      win->w_buffer->b_prompt_insert = restart_edit;
      restart_edit = NUL;
  
      // When leaving the window (or closing the window) was done from a
!     // callback we need to break out of the Insert mode loop and restart Insert
!     // mode when entering the window again.
      if (State & INSERT)
      {
  	stop_insert_mode = TRUE;
! 	if (win->w_buffer->b_prompt_insert == NUL)
  	    win->w_buffer->b_prompt_insert = 'A';
      }
  }
***************
*** 2125,2136 ****
      static void
  entering_window(win_T *win)
  {
      // When switching to a prompt buffer that was in Insert mode, don't stop
      // Insert mode, it may have been set in leaving_window().
!     if (bt_prompt(win->w_buffer) && win->w_buffer->b_prompt_insert != NUL)
  	stop_insert_mode = FALSE;
  
!     // When entering the prompt window may restart Insert mode.
      restart_edit = win->w_buffer->b_prompt_insert;
  }
  #endif
--- 2130,2146 ----
      static void
  entering_window(win_T *win)
  {
+     // Only matters for a prompt window.
+     if (!bt_prompt(win->w_buffer))
+ 	return;
+ 
      // When switching to a prompt buffer that was in Insert mode, don't stop
      // Insert mode, it may have been set in leaving_window().
!     if (win->w_buffer->b_prompt_insert != NUL)
  	stop_insert_mode = FALSE;
  
!     // When entering the prompt window restart Insert mode if we were in Insert
!     // mode when we left it.
      restart_edit = win->w_buffer->b_prompt_insert;
  }
  #endif
*** ../vim-8.1.0041/src/version.c	2018-06-10 13:55:48.527949068 +0200
--- src/version.c	2018-06-10 14:38:47.846545314 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     42,
  /**/

-- 
The only backup you need is the one that you didn't have time for.
(Murphy)

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