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

Reline#reset should initalize @rest_height and @screen_size eveytime

This commit is contained in:
aycabta 2019-05-22 02:52:29 +09:00
parent 232f1117e8
commit f8732bd4d6

View file

@ -81,10 +81,16 @@ class Reline::LineEditor
def initialize(config) def initialize(config)
@config = config @config = config
reset reset_variables
end end
def reset(prompt = '', encoding = Encoding.default_external) def reset(prompt = '', encoding = Encoding.default_external)
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
@screen_size = Reline::IOGate.get_screen_size
reset_variables(prompt, encoding)
end
def reset_variables(prompt = '', encoding = Encoding.default_external)
@prompt = prompt @prompt = prompt
@encoding = encoding @encoding = encoding
@prompt_width = calculate_width(@prompt) @prompt_width = calculate_width(@prompt)
@ -236,8 +242,6 @@ class Reline::LineEditor
end end
def rerender # TODO: support physical and logical lines def rerender # TODO: support physical and logical lines
@rest_height ||= (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
@screen_size ||= Reline::IOGate.get_screen_size
if @menu_info if @menu_info
@output.puts @output.puts
@menu_info.list.each do |item| @menu_info.list.each do |item|