aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reline/windows.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-08-29 21:05:19 +0900
committeraycabta <aycabta@gmail.com>2019-08-29 21:05:19 +0900
commit3a425c7623d2062ae931dc83050c00a12873217b (patch)
treea94635809e86430125063fd41d1a9c9e163f7210 /lib/reline/windows.rb
parentb74dd665c0e9558f355cbe1a625beb444c2a2ab4 (diff)
downloadruby-3a425c7623d2062ae931dc83050c00a12873217b.tar.gz
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.
Diffstat (limited to 'lib/reline/windows.rb')
-rw-r--r--lib/reline/windows.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index 0bd8d1b147..7d112e7632 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -131,7 +131,7 @@ class Reline::Windows
csbi = 0.chr * 22
@@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi)
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)
end