Skip to content

Commit a12970d

Browse files
committed
Manual Merge change 03234d9
ID Author Date Message 03234d9 Ray Hayes <[email protected]> 9/21/2016 10:59:16 AM -07:00 Fix initialization of fields in Windows/Windows communications.
1 parent b28bc1f commit a12970d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

contrib/win32/win32compat/shell-host.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ void SendKeyStroke(HANDLE hInput, int keyStroke, char character)
130130
ir.Event.KeyEvent.wVirtualKeyCode = keyStroke;
131131
ir.Event.KeyEvent.wVirtualScanCode = 0;
132132
ir.Event.KeyEvent.dwControlKeyState = 0;
133+
ir.Event.KeyEvent.uChar.UnicodeChar = 0;
133134
if(character != 0)
134135
ir.Event.KeyEvent.uChar.AsciiChar = character;
135136

@@ -674,6 +675,9 @@ DWORD ProcessEvent(void *p) {
674675

675676
DWORD WINAPI ProcessEventQueue(LPVOID p) {
676677

678+
static SHORT lastX = 0;
679+
static SHORT lastY = 0;
680+
677681
while (1) {
678682

679683
while (head) {
@@ -728,8 +732,15 @@ DWORD WINAPI ProcessEventQueue(LPVOID p) {
728732
GetConsoleScreenBufferInfoEx(child_out, &consoleInfo);
729733

730734
// Set the cursor to the last known good location according to the live buffer.
731-
SendSetCursor(pipe_out, consoleInfo.dwCursorPosition.X + 1,
732-
consoleInfo.dwCursorPosition.Y + 1);
735+
if (lastX != consoleInfo.dwCursorPosition.X ||
736+
lastY != consoleInfo.dwCursorPosition.Y) {
737+
738+
SendSetCursor(pipe_out, consoleInfo.dwCursorPosition.X + 1,
739+
consoleInfo.dwCursorPosition.Y + 1);
740+
}
741+
742+
lastX = consoleInfo.dwCursorPosition.X;
743+
lastY = consoleInfo.dwCursorPosition.Y;
733744
}
734745

735746
Sleep(100);

0 commit comments

Comments
 (0)