aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reline/line_editor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r--lib/reline/line_editor.rb10
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|