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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0940
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.0940
Problem: MS-Windows console resizing not handled properly.
Solution: Handle resizing the console better. (Nobuhiro Takasaki,
closes #3968, closes #3611)
Files: src/ex_docmd.c, src/normal.c, src/os_win32.c,
src/proto/os_win32.pro
*** ../vim-8.1.0939/src/ex_docmd.c 2019-02-08 14:33:54.818762019 +0100
--- src/ex_docmd.c 2019-02-17 14:53:03.973230504 +0100
***************
*** 9853,9858 ****
--- 9853,9861 ----
if (need_maketitle)
maketitle();
#endif
+ #if defined(WIN3264) && !defined(FEAT_GUI_W32)
+ resize_console_buf();
+ #endif
RedrawingDisabled = r;
p_lz = p;
*** ../vim-8.1.0939/src/normal.c 2019-02-16 15:09:21.209946237 +0100
--- src/normal.c 2019-02-17 14:53:03.973230504 +0100
***************
*** 5401,5406 ****
--- 5401,5409 ----
# endif
#endif
redraw_later(CLEAR);
+ #if defined(WIN3264) && !defined(FEAT_GUI_W32)
+ resize_console_buf();
+ #endif
}
}
*** ../vim-8.1.0939/src/os_win32.c 2019-02-17 14:10:52.105754303 +0100
--- src/os_win32.c 2019-02-17 15:00:20.974791478 +0100
***************
*** 1492,1497 ****
--- 1492,1499 ----
ui_focus_change((int)g_fJustGotFocus);
}
+ static void ResizeConBuf(HANDLE hConsole, COORD coordScreen);
+
/*
* Wait until console input from keyboard or mouse is available,
* or the time is up.
***************
*** 1657,1667 ****
handle_focus_event(ir);
else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT)
{
! /* Only call shell_resized() when the size actually change to
! * avoid the screen is cleard. */
! if (ir.Event.WindowBufferSizeEvent.dwSize.X != Columns
! || ir.Event.WindowBufferSizeEvent.dwSize.Y != Rows)
shell_resized();
}
#ifdef FEAT_MOUSE
else if (ir.EventType == MOUSE_EVENT
--- 1659,1676 ----
handle_focus_event(ir);
else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT)
{
! COORD dwSize = ir.Event.WindowBufferSizeEvent.dwSize;
!
! // Only call shell_resized() when the size actually change to
! // avoid the screen is cleard.
! if (dwSize.X != Columns || dwSize.Y != Rows)
! {
! CONSOLE_SCREEN_BUFFER_INFO csbi;
! GetConsoleScreenBufferInfo(g_hConOut, &csbi);
! dwSize.Y = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
! ResizeConBuf(g_hConOut, dwSize);
shell_resized();
+ }
}
#ifdef FEAT_MOUSE
else if (ir.EventType == MOUSE_EVENT
***************
*** 6327,6333 ****
* character was written, otherwise we get stuck. */
if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length,
coord, &cchwritten) == 0
! || cchwritten == 0)
cchwritten = 1;
}
else
--- 6336,6342 ----
* character was written, otherwise we get stuck. */
if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length,
coord, &cchwritten) == 0
! || cchwritten == 0 || cchwritten == (DWORD)-1)
cchwritten = 1;
}
else
***************
*** 6361,6367 ****
* character was written, otherwise we get stuck. */
if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite,
coord, &written) == 0
! || written == 0)
written = 1;
}
else
--- 6370,6376 ----
* character was written, otherwise we get stuck. */
if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite,
coord, &written) == 0
! || written == 0 || written == (DWORD)-1)
written = 1;
}
else
***************
*** 7707,7713 ****
}
! #ifndef FEAT_GUI_W32
static void
vtp_init(void)
--- 7716,7722 ----
}
! #if !defined(FEAT_GUI_W32) || defined(PROTO)
static void
vtp_init(void)
***************
*** 7931,7933 ****
--- 7940,7967 ----
{
return conpty_stable;
}
+
+ #if !defined(FEAT_GUI_W32) || defined(PROTO)
+ void
+ resize_console_buf(void)
+ {
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ COORD coord;
+ SMALL_RECT newsize;
+
+ if (GetConsoleScreenBufferInfo(g_hConOut, &csbi))
+ {
+ coord.X = SRWIDTH(csbi.srWindow);
+ coord.Y = SRHEIGHT(csbi.srWindow);
+ SetConsoleScreenBufferSize(g_hConOut, coord);
+
+ newsize.Left = 0;
+ newsize.Top = 0;
+ newsize.Right = coord.X - 1;
+ newsize.Bottom = coord.Y - 1;
+ SetConsoleWindowInfo(g_hConOut, TRUE, &newsize);
+
+ SetConsoleScreenBufferSize(g_hConOut, coord);
+ }
+ }
+ #endif
*** ../vim-8.1.0939/src/proto/os_win32.pro 2019-02-13 19:23:04.734816702 +0100
--- src/proto/os_win32.pro 2019-02-17 14:53:03.977230484 +0100
***************
*** 75,78 ****
--- 75,79 ----
int has_vtp_working(void);
int has_conpty_working(void);
int is_conpty_stable(void);
+ void resize_console_buf(void);
/* vim: set ft=c : */
*** ../vim-8.1.0939/src/version.c 2019-02-17 14:50:22.438125825 +0100
--- src/version.c 2019-02-17 14:56:57.147933610 +0100
***************
*** 781,782 ****
--- 781,784 ----
{ /* Add new patch number below this line */
+ /**/
+ 940,
/**/
--
The word "leader" is derived from the word "lead", as in the material that
bullets are made out of. The term "leader" was popularized at about the same
time as the invention of firearms. It grew out of the observation that the
person in charge of every organization was the person whom everyone wanted to
fill with hot lead.
I don't recomment this; it's just a point of historical interest.
(Scott Adams - The Dilbert principle)
/// 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 ///
|