Guest User

Untitled

a guest
Feb 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. # HG changeset patch
  2. # Parent 8d0990dda8627ba9b7e2647b8f586deb0090f81e
  3.  
  4. diff --git a/src/os_win32.c b/src/os_win32.c
  5. --- a/src/os_win32.c
  6. +++ b/src/os_win32.c
  7. @@ -1463,6 +1463,8 @@ handle_focus_event(INPUT_RECORD ir)
  8. ui_focus_change((int)g_fJustGotFocus);
  9. }
  10.  
  11. +static void ResizeConBuf(HANDLE hConsole, COORD coordScreen);
  12. +
  13. /*
  14. * Wait until console input from keyboard or mouse is available,
  15. * or the time is up.
  16. @@ -1628,11 +1630,17 @@ WaitForChar(long msec, int ignore_input)
  17. handle_focus_event(ir);
  18. else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT)
  19. {
  20. + COORD dwSize = ir.Event.WindowBufferSizeEvent.dwSize;
  21. /* Only call shell_resized() when the size actually change to
  22. * avoid the screen is cleard. */
  23. - if (ir.Event.WindowBufferSizeEvent.dwSize.X != Columns
  24. - || ir.Event.WindowBufferSizeEvent.dwSize.Y != Rows)
  25. + if (dwSize.X != Columns || dwSize.Y != Rows)
  26. + {
  27. + CONSOLE_SCREEN_BUFFER_INFO csbi;
  28. + GetConsoleScreenBufferInfo(g_hConOut, &csbi);
  29. + dwSize.Y = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
  30. + ResizeConBuf(g_hConOut, dwSize);
  31. shell_resized();
  32. + }
  33. }
  34. #ifdef FEAT_MOUSE
  35. else if (ir.EventType == MOUSE_EVENT
  36. @@ -5833,7 +5841,7 @@ write_chars(
  37. // character was written, otherwise we get stuck.
  38. if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length,
  39. coord, &cchwritten) == 0
  40. - || cchwritten == 0)
  41. + || cchwritten == 0 || cchwritten == (DWORD)-1)
  42. cchwritten = 1;
  43. }
  44. else
Add Comment
Please, Sign In to add comment