1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

CONSOLE_SCREEN_BUFFER_INFO is 22bytes

typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
  COORD      dwSize;              // 4(SHORT X, Y)
  COORD      dwCursorPosition;    // 4
  WORD       wAttributes;         // 2
  SMALL_RECT srWindow;            // 8(SHORT Left, Top, Right, Bottom)
  COORD      dwMaximumWindowSize; // 4
} CONSOLE_SCREEN_BUFFER_INFO;
This commit is contained in:
aycabta 2019-08-29 20:59:29 +09:00
parent a4a19b114b
commit b74dd665c0

View file

@ -122,13 +122,13 @@ class Reline::Windows
end
def self.get_screen_size
csbi = 0.chr * 24
csbi = 0.chr * 22
@@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi)
csbi[0, 4].unpack('SS').reverse
end
def self.cursor_pos
csbi = 0.chr * 24
csbi = 0.chr * 22
@@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi)
x = csbi[4, 2].unpack('s*').first
y = csbi[6, 4].unpack('s*').first