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

Use reversed get_screen_size correctly on Windows

This commit is contained in:
aycabta 2019-05-29 18:52:20 +09:00
parent 5ceff480c2
commit fafcbe0eb0

View file

@ -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)