mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix alignment of a SHORT variable
typedef struct _COORD { SHORT X; SHORT Y; // I wanted to take this... } COORD, *PCOORD; typedef struct _CONSOLE_SCREEN_BUFFER_INFO { COORD dwSize; COORD dwCursorPosition; // ...of this one WORD wAttributes; // But it's combined with first 2bytes of this SMALL_RECT srWindow; COORD dwMaximumWindowSize; } CONSOLE_SCREEN_BUFFER_INFO; If wAttributes has non-zero value, the code breaks.
This commit is contained in:
parent
b74dd665c0
commit
3a425c7623
1 changed files with 1 additions and 1 deletions
|
@ -131,7 +131,7 @@ class Reline::Windows
|
||||||
csbi = 0.chr * 22
|
csbi = 0.chr * 22
|
||||||
@@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi)
|
@@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi)
|
||||||
x = csbi[4, 2].unpack('s*').first
|
x = csbi[4, 2].unpack('s*').first
|
||||||
y = csbi[6, 4].unpack('s*').first
|
y = csbi[6, 2].unpack('s*').first
|
||||||
Reline::CursorPos.new(x, y)
|
Reline::CursorPos.new(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue