mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] not clear scrollback buffer
https://github.com/ruby/reline/commit/ba800f1461
This commit is contained in:
parent
0862744010
commit
a840ef8569
1 changed files with 8 additions and 6 deletions
|
@ -250,15 +250,17 @@ class Reline::Windows
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.clear_screen
|
def self.clear_screen
|
||||||
coord_screen_top_left = 0
|
|
||||||
written = 0.chr * 4
|
|
||||||
csbi = 0.chr * 22
|
csbi = 0.chr * 22
|
||||||
return if @@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi) == 0
|
return if @@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi) == 0
|
||||||
con_size = csbi[0, 4].unpack('SS').inject(:*)
|
buffer_width = csbi[0, 2].unpack('S').first
|
||||||
attributes = csbi[8, 2].unpack('S').first
|
attributes = csbi[8, 2].unpack('S').first
|
||||||
@@FillConsoleOutputCharacter.call(@@hConsoleHandle, 0x20, con_size, coord_screen_top_left, written)
|
window_left, window_top, window_right, window_bottom = *csbi[10,8].unpack('S*')
|
||||||
@@FillConsoleOutputAttribute.call(@@hConsoleHandle, attributes, con_size, coord_screen_top_left, written)
|
fill_length = buffer_width * (window_bottom - window_top + 1)
|
||||||
@@SetConsoleCursorPosition.call(@@hConsoleHandle, coord_screen_top_left)
|
screen_topleft = window_top * 65536
|
||||||
|
written = 0.chr * 4
|
||||||
|
@@FillConsoleOutputCharacter.call(@@hConsoleHandle, 0x20, fill_length, screen_topleft, written)
|
||||||
|
@@FillConsoleOutputAttribute.call(@@hConsoleHandle, attributes, fill_length, screen_topleft, written)
|
||||||
|
@@SetConsoleCursorPosition.call(@@hConsoleHandle, screen_topleft)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.set_screen_size(rows, columns)
|
def self.set_screen_size(rows, columns)
|
||||||
|
|
Loading…
Add table
Reference in a new issue