Skip to content

Commit

Permalink
Correctly report the terminal size on windows, fixes #136
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jun 11, 2018
1 parent 65c3450 commit 9999987
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ protected void setConsoleMode(int mode) {
}

public Size getSize() {
long outputHandle = Kernel32.GetStdHandle(Kernel32.STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO();
Kernel32.GetConsoleScreenBufferInfo(outputHandle, info);
Size size = new Size();
size.setColumns(WindowsSupport.getWindowsTerminalWidth());
size.setRows(WindowsSupport.getWindowsTerminalHeight());
size.setColumns(info.size.x);
size.setRows(info.size.y);
return size;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected void setConsoleMode(int mode) {
public Size getSize() {
Kernel32.CONSOLE_SCREEN_BUFFER_INFO info = new Kernel32.CONSOLE_SCREEN_BUFFER_INFO();
Kernel32.INSTANCE.GetConsoleScreenBufferInfo(consoleOut, info);
return new Size(info.windowWidth(), info.windowHeight());
return new Size(info.dwSize.X, info.dwSize.Y);
}

protected boolean processConsoleInput() throws IOException {
Expand Down

0 comments on commit 9999987

Please sign in to comment.