From fafcbe0eb0af0aa25ca1fa6e162e081bb78a8107 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 29 May 2019 18:52:20 +0900 Subject: [PATCH] Use reversed get_screen_size correctly on Windows --- lib/reline/windows.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb index 7ba28adb5a..b64ea97295 100644 --- a/lib/reline/windows.rb +++ b/lib/reline/windows.rb @@ -150,12 +150,12 @@ class Reline::Windows @@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi) cursor = csbi[4, 4].unpack('L').first written = 0.chr * 4 - @@FillConsoleOutputCharacter.call(@@hConsoleHandle, 0x20, get_screen_size.first - cursor_pos.x, cursor, written) + @@FillConsoleOutputCharacter.call(@@hConsoleHandle, 0x20, get_screen_size.last - cursor_pos.x, cursor, written) end def self.scroll_down(val) return if val.zero? - scroll_rectangle = [0, val, get_screen_size.last, get_screen_size.first].pack('s4') + scroll_rectangle = [0, val, get_screen_size.first, get_screen_size.last].pack('s4') destination_origin = 0 # y * 65536 + x fill = [' '.ord, 0].pack('SS') @@ScrollConsoleScreenBuffer.call(@@hConsoleHandle, scroll_rectangle, nil, destination_origin, fill)