Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

don't use rocket if stdout outputs more than current terminal height

  • Loading branch information...
commit d49c5f9c3993d30b776569fa83fd6578b3010e89 1 parent 5bab020
Jan Lelis authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/fancy_irb/irb_ext.rb
5 lib/fancy_irb/irb_ext.rb
View
@@ -35,12 +35,15 @@ def output_value
last_line_without_prompt = last_input.split("\n").last
offset = last_line_without_prompt.size + FancyIrb.real_lengths[:input_prompt] + 1
screen_length = `tput cols`.to_i
+ screen_lines = `tput lines`.to_i
output_length = FancyIrb.real_lengths[:output]
rocket_length = FancyIrb[:rocket_prompt].size
stdout_lines = FancyIrb.get_height
# auto rocket mode
- if FancyIrb[:rocket_mode] && screen_length > offset + rocket_length + output_length
+ if FancyIrb[:rocket_mode] &&
+ screen_length > offset + rocket_length + output_length &&
+ stdout_lines < screen_lines
print `tput sc` + # save current cursor position
`tput cuu1`*stdout_lines + # move cursor upwards to the original input line
`tput cuf1`*offset + # move cursor rightwards to the original input offset
Please sign in to comment.
Something went wrong with that request. Please try again.