Skip to content

Commit c732857

Browse files
committed
Avoid using CSI # S for scroll down
1 parent 46db711 commit c732857

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/reline/ansi.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,12 @@ def self.erase_after_cursor
335335
@@output.write "\e[K"
336336
end
337337

338+
# This only works when the cursor is at the bottom of the scroll range
339+
# For more details, see https://github.com/ruby/reline/pull/577#issuecomment-1646679623
338340
def self.scroll_down(x)
339341
return if x.zero?
340-
@@output.write "\e[#{x}S"
342+
# We use `\n` instead of CSI + S because CSI + S would cause https://github.com/ruby/reline/issues/576
343+
@@output.write "\n" * x
341344
end
342345

343346
def self.clear_screen

0 commit comments

Comments
 (0)