diff options
author | aycabta <aycabta@gmail.com> | 2019-05-22 02:52:29 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-22 02:52:29 +0900 |
commit | f8732bd4d65cf0b776348907b56bd58f4f79ca9c (patch) | |
tree | a441d1242ad67991864e03b1d7ec832bcf1f6ffb /lib | |
parent | 232f1117e8aa83ed315d2f0c5ebaaa68e722d204 (diff) | |
download | ruby-f8732bd4d65cf0b776348907b56bd58f4f79ca9c.tar.gz |
Reline#reset should initalize @rest_height and @screen_size eveytime
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 6c7c5bdd38..95d7c925b2 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -81,10 +81,16 @@ class Reline::LineEditor def initialize(config) @config = config - reset + reset_variables end 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 @encoding = encoding @prompt_width = calculate_width(@prompt) @@ -236,8 +242,6 @@ class Reline::LineEditor end 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 @output.puts @menu_info.list.each do |item| |