summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0171
blob: 3ea192f73c8fa95062d92b41f673b5cd09369768 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0171
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.0171
Problem:    Typing CTRL-W n in a terminal window causes ml_get error.
Solution:   When resizing the terminal outside of terminal_loop() make sure
            the snapshot is complete.
Files:	    src/terminal.c, src/testdir/test_terminal.vim


*** ../vim-8.1.0170/src/terminal.c	Sun Jul  8 16:50:33 2018
--- src/terminal.c	Sun Jul  8 20:48:42 2018
***************
*** 3134,3146 ****
  
      if (term->tl_rows != newrows || term->tl_cols != newcols)
      {
- 
- 
  	term->tl_vterm_size_changed = TRUE;
  	vterm_set_size(vterm, newrows, newcols);
  	ch_log(term->tl_job->jv_channel, "Resizing terminal to %d lines",
  								      newrows);
  	term_report_winsize(term, newrows, newcols);
      }
  
      /* The cursor may have been moved when resizing. */
--- 3134,3149 ----
  
      if (term->tl_rows != newrows || term->tl_cols != newcols)
      {
  	term->tl_vterm_size_changed = TRUE;
  	vterm_set_size(vterm, newrows, newcols);
  	ch_log(term->tl_job->jv_channel, "Resizing terminal to %d lines",
  								      newrows);
  	term_report_winsize(term, newrows, newcols);
+ 
+ 	// Updating the terminal size will cause the snapshot to be cleared.
+ 	// When not in terminal_loop() we need to restore it.
+ 	if (term != in_terminal_loop)
+ 	    may_move_terminal_to_buffer(term, FALSE);
      }
  
      /* The cursor may have been moved when resizing. */
*** ../vim-8.1.0170/src/testdir/test_terminal.vim	Tue Jun 19 20:08:10 2018
--- src/testdir/test_terminal.vim	Sun Jul  8 20:46:08 2018
***************
*** 1525,1530 ****
--- 1525,1556 ----
    exe buf . 'bwipe!'
  endfunc
  
+ " Resizing the terminal window caused an ml_get error.
+ " TODO: This does not reproduce the original problem.
+ func Test_terminal_resize()
+   set statusline=x
+   terminal
+   call assert_equal(2, winnr('$'))
+ 
+   " Fill the terminal with text.
+   if has('win32')
+     call feedkeys("dir\<CR>", 'xt')
+   else
+     call feedkeys("ls\<CR>", 'xt')
+   endif
+   " Go to Terminal-Normal mode for a moment.
+   call feedkeys("\<C-W>N", 'xt')
+   " Open a new window
+   call feedkeys("i\<C-W>n", 'xt')
+   call assert_equal(3, winnr('$'))
+   redraw
+ 
+   close
+   call assert_equal(2, winnr('$'))
+   call feedkeys("exit\<CR>", 'xt')
+   set statusline&
+ endfunc
+ 
  " must be nearly the last, we can't go back from GUI to terminal
  func Test_zz1_terminal_in_gui()
    if !CanRunGui()
*** ../vim-8.1.0170/src/version.c	Sun Jul  8 19:07:16 2018
--- src/version.c	Sun Jul  8 20:46:58 2018
***************
*** 791,792 ****
--- 791,794 ----
  {   /* Add new patch number below this line */
+ /**/
+     171,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
215. Your mouse-clicking forearm rivals Popeye's.

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