mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Support for multiple dialog rendering
https://github.com/ruby/reline/commit/f589fab718
This commit is contained in:
parent
acffb0b068
commit
8d4370b066
2 changed files with 115 additions and 75 deletions
|
@ -34,7 +34,7 @@ module Reline
|
||||||
auto_indent_proc
|
auto_indent_proc
|
||||||
pre_input_hook
|
pre_input_hook
|
||||||
dig_perfect_match_proc
|
dig_perfect_match_proc
|
||||||
dialog_proc
|
dialog_proc_list
|
||||||
).each(&method(:attr_reader))
|
).each(&method(:attr_reader))
|
||||||
|
|
||||||
attr_accessor :config
|
attr_accessor :config
|
||||||
|
@ -48,6 +48,7 @@ module Reline
|
||||||
yield self
|
yield self
|
||||||
@completion_quote_character = nil
|
@completion_quote_character = nil
|
||||||
@bracketed_paste_finished = false
|
@bracketed_paste_finished = false
|
||||||
|
@dialog_proc_list = []
|
||||||
end
|
end
|
||||||
|
|
||||||
def encoding
|
def encoding
|
||||||
|
@ -131,9 +132,10 @@ module Reline
|
||||||
@dig_perfect_match_proc = p
|
@dig_perfect_match_proc = p
|
||||||
end
|
end
|
||||||
|
|
||||||
def dialog_proc=(p)
|
def add_dialog_proc(name_sym, p)
|
||||||
raise ArgumentError unless p.respond_to?(:call) or p.nil?
|
raise ArgumentError unless p.respond_to?(:call) or p.nil?
|
||||||
@dialog_proc = p
|
raise ArgumentError unless name_sym.instance_of?(Symbol)
|
||||||
|
@dialog_proc_list << [name_sym, p]
|
||||||
end
|
end
|
||||||
|
|
||||||
def input=(val)
|
def input=(val)
|
||||||
|
@ -206,14 +208,15 @@ module Reline
|
||||||
else
|
else
|
||||||
y = 0
|
y = 0
|
||||||
end
|
end
|
||||||
[Reline::CursorPos.new(x, y), result, pointer]
|
cursor_pos_to_render = Reline::CursorPos.new(x, y)
|
||||||
|
[cursor_pos_to_render, result, pointer]
|
||||||
}
|
}
|
||||||
|
|
||||||
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
|
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
|
||||||
unless confirm_multiline_termination
|
unless confirm_multiline_termination
|
||||||
raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
|
raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
|
||||||
end
|
end
|
||||||
@dialog_proc = DEFAULT_DIALOG_PROC_AUTOCOMPLETE
|
add_dialog_proc(:autocomplete, DEFAULT_DIALOG_PROC_AUTOCOMPLETE)
|
||||||
inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
|
inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
|
||||||
|
|
||||||
whole_buffer = line_editor.whole_buffer.dup
|
whole_buffer = line_editor.whole_buffer.dup
|
||||||
|
@ -269,7 +272,10 @@ module Reline
|
||||||
line_editor.auto_indent_proc = auto_indent_proc
|
line_editor.auto_indent_proc = auto_indent_proc
|
||||||
line_editor.dig_perfect_match_proc = dig_perfect_match_proc
|
line_editor.dig_perfect_match_proc = dig_perfect_match_proc
|
||||||
line_editor.pre_input_hook = pre_input_hook
|
line_editor.pre_input_hook = pre_input_hook
|
||||||
line_editor.dialog_proc = dialog_proc
|
@dialog_proc_list.each do |d|
|
||||||
|
name_sym, dialog_proc = d
|
||||||
|
line_editor.add_dialog_proc(name_sym, dialog_proc)
|
||||||
|
end
|
||||||
|
|
||||||
unless config.test_mode
|
unless config.test_mode
|
||||||
config.read
|
config.read
|
||||||
|
|
|
@ -249,10 +249,7 @@ class Reline::LineEditor
|
||||||
@drop_terminate_spaces = false
|
@drop_terminate_spaces = false
|
||||||
@in_pasting = false
|
@in_pasting = false
|
||||||
@auto_indent_proc = nil
|
@auto_indent_proc = nil
|
||||||
@dialog_column = nil
|
@dialogs = []
|
||||||
@dialog_vertical_offset = nil
|
|
||||||
@dialog_contents = nil
|
|
||||||
@dialog_lines_backup = nil
|
|
||||||
reset_line
|
reset_line
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -521,75 +518,98 @@ class Reline::LineEditor
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def dialog_proc=(p)
|
class Dialog
|
||||||
@dialog_proc_scope = DialogProcScope.new(self, p)
|
attr_reader :name
|
||||||
@dialog_proc = p
|
attr_accessor :column, :vertical_offset, :contents, :lines_backup
|
||||||
|
|
||||||
|
def initialize(name, proc_scope)
|
||||||
|
@name = name
|
||||||
|
@proc_scope = proc_scope
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_cursor_pos(col, row)
|
||||||
|
@proc_scope.set_cursor_pos(col, row)
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
@proc_scope.call
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
DIALOG_HEIGHT = 5
|
def add_dialog_proc(name, p)
|
||||||
|
return if @dialogs.any? { |d| d.name == name }
|
||||||
|
@dialogs << Dialog.new(name, DialogProcScope.new(self, p))
|
||||||
|
end
|
||||||
|
|
||||||
|
DIALOG_HEIGHT = 20
|
||||||
DIALOG_WIDTH = 40
|
DIALOG_WIDTH = 40
|
||||||
private def render_dialog(cursor_column)
|
private def render_dialog(cursor_column)
|
||||||
return if @dialog_proc_scope.nil?
|
@dialogs.each do |dialog|
|
||||||
|
render_each_dialog(dialog, cursor_column)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private def render_each_dialog(dialog, cursor_column)
|
||||||
if @in_pasting
|
if @in_pasting
|
||||||
@dialog_contents = nil
|
dialog.contents = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@dialog_proc_scope.set_cursor_pos(cursor_column, @first_line_started_from + @started_from)
|
dialog.set_cursor_pos(cursor_column, @first_line_started_from + @started_from)
|
||||||
pos, result, pointer = @dialog_proc_scope.call
|
pos, result, pointer = dialog.call
|
||||||
old_dialog_contents = @dialog_contents
|
old_dialog_contents = dialog.contents
|
||||||
old_dialog_column = @dialog_column
|
old_dialog_column = dialog.column
|
||||||
old_dialog_vertical_offset = @dialog_vertical_offset
|
old_dialog_vertical_offset = dialog.vertical_offset
|
||||||
if result and not result.empty?
|
if result and not result.empty?
|
||||||
@dialog_contents = result
|
dialog.contents = result
|
||||||
@dialog_contents = @dialog_contents[0...DIALOG_HEIGHT] if @dialog_contents.size > DIALOG_HEIGHT
|
dialog.contents = dialog.contents[0...DIALOG_HEIGHT] if dialog.contents.size > DIALOG_HEIGHT
|
||||||
else
|
else
|
||||||
@dialog_lines_backup = {
|
dialog.lines_backup = {
|
||||||
lines: modify_lines(whole_lines),
|
lines: modify_lines(whole_lines),
|
||||||
line_index: @line_index,
|
line_index: @line_index,
|
||||||
first_line_started_from: @first_line_started_from,
|
first_line_started_from: @first_line_started_from,
|
||||||
started_from: @started_from,
|
started_from: @started_from,
|
||||||
byte_pointer: @byte_pointer
|
byte_pointer: @byte_pointer
|
||||||
}
|
}
|
||||||
clear_dialog
|
clear_each_dialog(dialog)
|
||||||
@dialog_contents = nil
|
dialog.contents = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
upper_space = @first_line_started_from - @started_from
|
upper_space = @first_line_started_from - @started_from
|
||||||
lower_space = @highest_in_all - @first_line_started_from - @started_from - 1
|
lower_space = @highest_in_all - @first_line_started_from - @started_from - 1
|
||||||
@dialog_column = pos.x
|
dialog.column = pos.x
|
||||||
diff = (@dialog_column + DIALOG_WIDTH) - (@screen_size.last - 1)
|
diff = (dialog.column + DIALOG_WIDTH) - (@screen_size.last - 1)
|
||||||
if diff > 0
|
if diff > 0
|
||||||
@dialog_column -= diff
|
dialog.column -= diff
|
||||||
end
|
end
|
||||||
if (lower_space + @rest_height) >= DIALOG_HEIGHT
|
if (lower_space + @rest_height) >= DIALOG_HEIGHT
|
||||||
@dialog_vertical_offset = pos.y + 1
|
dialog.vertical_offset = pos.y + 1
|
||||||
elsif upper_space >= DIALOG_HEIGHT
|
elsif upper_space >= DIALOG_HEIGHT
|
||||||
@dialog_vertical_offset = pos.y + -(DIALOG_HEIGHT + 1)
|
dialog.vertical_offset = pos.y + -(DIALOG_HEIGHT + 1)
|
||||||
else
|
else
|
||||||
if (lower_space + @rest_height) < DIALOG_HEIGHT
|
if (lower_space + @rest_height) < DIALOG_HEIGHT
|
||||||
scroll_down(DIALOG_HEIGHT)
|
scroll_down(DIALOG_HEIGHT)
|
||||||
move_cursor_up(DIALOG_HEIGHT)
|
move_cursor_up(DIALOG_HEIGHT)
|
||||||
end
|
end
|
||||||
@dialog_vertical_offset = pos.y + 1
|
dialog.vertical_offset = pos.y + 1
|
||||||
end
|
end
|
||||||
Reline::IOGate.hide_cursor
|
Reline::IOGate.hide_cursor
|
||||||
reset_dialog(old_dialog_contents, old_dialog_column, old_dialog_vertical_offset)
|
reset_dialog(dialog, old_dialog_contents, old_dialog_column, old_dialog_vertical_offset)
|
||||||
move_cursor_down(@dialog_vertical_offset)
|
move_cursor_down(dialog.vertical_offset)
|
||||||
Reline::IOGate.move_cursor_column(@dialog_column)
|
Reline::IOGate.move_cursor_column(dialog.column)
|
||||||
@dialog_contents.each_with_index do |item, i|
|
dialog.contents.each_with_index do |item, i|
|
||||||
if i == pointer
|
if i == pointer
|
||||||
bg_color = '45'
|
bg_color = '45'
|
||||||
else
|
else
|
||||||
bg_color = '46'
|
bg_color = '46'
|
||||||
end
|
end
|
||||||
@output.write "\e[#{bg_color}m%-#{DIALOG_WIDTH}s\e[49m" % item.slice(0, DIALOG_WIDTH)
|
@output.write "\e[#{bg_color}m%-#{DIALOG_WIDTH}s\e[49m" % item.slice(0, DIALOG_WIDTH)
|
||||||
Reline::IOGate.move_cursor_column(@dialog_column)
|
Reline::IOGate.move_cursor_column(dialog.column)
|
||||||
move_cursor_down(1) if i < (@dialog_contents.size - 1)
|
move_cursor_down(1) if i < (dialog.contents.size - 1)
|
||||||
end
|
end
|
||||||
Reline::IOGate.move_cursor_column(cursor_column)
|
Reline::IOGate.move_cursor_column(cursor_column)
|
||||||
move_cursor_up(@dialog_vertical_offset + @dialog_contents.size - 1)
|
move_cursor_up(dialog.vertical_offset + dialog.contents.size - 1)
|
||||||
Reline::IOGate.show_cursor
|
Reline::IOGate.show_cursor
|
||||||
@dialog_lines_backup = {
|
dialog.lines_backup = {
|
||||||
lines: modify_lines(whole_lines),
|
lines: modify_lines(whole_lines),
|
||||||
line_index: @line_index,
|
line_index: @line_index,
|
||||||
first_line_started_from: @first_line_started_from,
|
first_line_started_from: @first_line_started_from,
|
||||||
|
@ -598,53 +618,61 @@ class Reline::LineEditor
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
private def reset_dialog(old_dialog_contents, old_dialog_column, old_dialog_vertical_offset)
|
private def reset_dialog(dialog, old_dialog_contents, old_dialog_column, old_dialog_vertical_offset)
|
||||||
return if @dialog_lines_backup.nil? or old_dialog_contents.nil?
|
return if dialog.lines_backup.nil? or old_dialog_contents.nil?
|
||||||
prompt, prompt_width, prompt_list = check_multiline_prompt(@dialog_lines_backup[:lines], prompt)
|
prompt, prompt_width, prompt_list = check_multiline_prompt(dialog.lines_backup[:lines], prompt)
|
||||||
visual_lines = []
|
visual_lines = []
|
||||||
visual_start = nil
|
visual_start = nil
|
||||||
@dialog_lines_backup[:lines].each_with_index { |l, i|
|
dialog.lines_backup[:lines].each_with_index { |l, i|
|
||||||
pr = prompt_list ? prompt_list[i] : prompt
|
pr = prompt_list ? prompt_list[i] : prompt
|
||||||
vl, _ = split_by_width(pr + l, @screen_size.last)
|
vl, _ = split_by_width(pr + l, @screen_size.last)
|
||||||
vl.compact!
|
vl.compact!
|
||||||
if i == @dialog_lines_backup[:line_index]
|
if i == dialog.lines_backup[:line_index]
|
||||||
visual_start = visual_lines.size + @dialog_lines_backup[:started_from]
|
visual_start = visual_lines.size + dialog.lines_backup[:started_from]
|
||||||
end
|
end
|
||||||
visual_lines.concat(vl)
|
visual_lines.concat(vl)
|
||||||
}
|
}
|
||||||
old_y = @dialog_lines_backup[:first_line_started_from] + @dialog_lines_backup[:started_from]
|
old_y = dialog.lines_backup[:first_line_started_from] + dialog.lines_backup[:started_from]
|
||||||
y = @first_line_started_from + @started_from
|
y = @first_line_started_from + @started_from
|
||||||
y_diff = y - old_y
|
y_diff = y - old_y
|
||||||
if (old_y + old_dialog_vertical_offset) < (y + @dialog_vertical_offset)
|
if (old_y + old_dialog_vertical_offset) < (y + dialog.vertical_offset)
|
||||||
# rerender top
|
# rerender top
|
||||||
move_cursor_down(old_dialog_vertical_offset - y_diff)
|
move_cursor_down(old_dialog_vertical_offset - y_diff)
|
||||||
start = visual_start + old_dialog_vertical_offset
|
start = visual_start + old_dialog_vertical_offset
|
||||||
line_num = @dialog_vertical_offset - old_dialog_vertical_offset
|
line_num = dialog.vertical_offset - old_dialog_vertical_offset
|
||||||
line_num.times do |i|
|
line_num.times do |i|
|
||||||
Reline::IOGate.move_cursor_column(0)
|
Reline::IOGate.move_cursor_column(old_dialog_column)
|
||||||
@output.write "\e[39m\e[49m#{visual_lines[start + i]}\e[39m\e[49m"
|
if visual_lines[start + i].nil?
|
||||||
Reline::IOGate.erase_after_cursor
|
s = ' ' * DIALOG_WIDTH
|
||||||
|
else
|
||||||
|
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog_column, DIALOG_WIDTH)
|
||||||
|
end
|
||||||
|
@output.write "\e[39m\e[49m%-#{DIALOG_WIDTH}s\e[39m\e[49m" % s
|
||||||
move_cursor_down(1) if i < (line_num - 1)
|
move_cursor_down(1) if i < (line_num - 1)
|
||||||
end
|
end
|
||||||
move_cursor_up(old_dialog_vertical_offset + line_num - 1 - y_diff)
|
move_cursor_up(old_dialog_vertical_offset + line_num - 1 - y_diff)
|
||||||
end
|
end
|
||||||
if (old_y + old_dialog_vertical_offset + old_dialog_contents.size) > (y + @dialog_vertical_offset + @dialog_contents.size)
|
if (old_y + old_dialog_vertical_offset + old_dialog_contents.size) > (y + dialog.vertical_offset + dialog.contents.size)
|
||||||
# rerender bottom
|
# rerender bottom
|
||||||
move_cursor_down(@dialog_vertical_offset + @dialog_contents.size - y_diff)
|
move_cursor_down(dialog.vertical_offset + dialog.contents.size - y_diff)
|
||||||
start = visual_start + @dialog_vertical_offset + @dialog_contents.size
|
start = visual_start + dialog.vertical_offset + dialog.contents.size
|
||||||
line_num = (old_dialog_vertical_offset + old_dialog_contents.size) - (@dialog_vertical_offset + @dialog_contents.size)
|
line_num = (old_dialog_vertical_offset + old_dialog_contents.size) - (dialog.vertical_offset + dialog.contents.size)
|
||||||
line_num.times do |i|
|
line_num.times do |i|
|
||||||
Reline::IOGate.move_cursor_column(0)
|
Reline::IOGate.move_cursor_column(old_dialog_column)
|
||||||
@output.write "\e[39m\e[49m#{visual_lines[start + i]}\e[39m\e[49m"
|
if visual_lines[start + i].nil?
|
||||||
Reline::IOGate.erase_after_cursor
|
s = ' ' * DIALOG_WIDTH
|
||||||
|
else
|
||||||
|
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog_column, DIALOG_WIDTH)
|
||||||
|
end
|
||||||
|
@output.write "\e[39m\e[49m%-#{DIALOG_WIDTH}s\e[39m\e[49m" % s
|
||||||
move_cursor_down(1) if i < (line_num - 1)
|
move_cursor_down(1) if i < (line_num - 1)
|
||||||
end
|
end
|
||||||
move_cursor_up(@dialog_vertical_offset + @dialog_contents.size + line_num - 1 - y_diff)
|
move_cursor_up(dialog.vertical_offset + dialog.contents.size + line_num - 1 - y_diff)
|
||||||
end
|
end
|
||||||
if old_dialog_column < @dialog_column
|
if old_dialog_column < dialog.column
|
||||||
# rerender left
|
# rerender left
|
||||||
move_cursor_down(old_dialog_vertical_offset - y_diff)
|
move_cursor_down(old_dialog_vertical_offset - y_diff)
|
||||||
width = @dialog_column - old_dialog_column
|
width = dialog.column - old_dialog_column
|
||||||
start = visual_start + old_dialog_vertical_offset
|
start = visual_start + old_dialog_vertical_offset
|
||||||
line_num = old_dialog_contents.size
|
line_num = old_dialog_contents.size
|
||||||
line_num.times do |i|
|
line_num.times do |i|
|
||||||
|
@ -659,10 +687,10 @@ class Reline::LineEditor
|
||||||
end
|
end
|
||||||
move_cursor_up(old_dialog_vertical_offset + line_num - 1 - y_diff)
|
move_cursor_up(old_dialog_vertical_offset + line_num - 1 - y_diff)
|
||||||
end
|
end
|
||||||
if (old_dialog_column + DIALOG_WIDTH) > (@dialog_column + DIALOG_WIDTH)
|
if (old_dialog_column + DIALOG_WIDTH) > (dialog.column + DIALOG_WIDTH)
|
||||||
# rerender right
|
# rerender right
|
||||||
move_cursor_down(old_dialog_vertical_offset + y_diff)
|
move_cursor_down(old_dialog_vertical_offset + y_diff)
|
||||||
width = (old_dialog_column + DIALOG_WIDTH) - (@dialog_column + DIALOG_WIDTH)
|
width = (old_dialog_column + DIALOG_WIDTH) - (dialog.column + DIALOG_WIDTH)
|
||||||
start = visual_start + old_dialog_vertical_offset
|
start = visual_start + old_dialog_vertical_offset
|
||||||
line_num = old_dialog_contents.size
|
line_num = old_dialog_contents.size
|
||||||
line_num.times do |i|
|
line_num.times do |i|
|
||||||
|
@ -672,7 +700,7 @@ class Reline::LineEditor
|
||||||
else
|
else
|
||||||
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog_column + DIALOG_WIDTH, width)
|
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog_column + DIALOG_WIDTH, width)
|
||||||
end
|
end
|
||||||
Reline::IOGate.move_cursor_column(@dialog_column + DIALOG_WIDTH)
|
Reline::IOGate.move_cursor_column(dialog.column + DIALOG_WIDTH)
|
||||||
@output.write "\e[39m\e[49m%-#{width}s\e[39m\e[49m" % s
|
@output.write "\e[39m\e[49m%-#{width}s\e[39m\e[49m" % s
|
||||||
move_cursor_down(1) if i < (line_num - 1)
|
move_cursor_down(1) if i < (line_num - 1)
|
||||||
end
|
end
|
||||||
|
@ -682,36 +710,42 @@ class Reline::LineEditor
|
||||||
end
|
end
|
||||||
|
|
||||||
private def clear_dialog
|
private def clear_dialog
|
||||||
return unless @dialog_contents
|
@dialogs.each do |dialog|
|
||||||
prompt, prompt_width, prompt_list = check_multiline_prompt(@dialog_lines_backup[:lines], prompt)
|
clear_each_dialog(dialog)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private def clear_each_dialog(dialog)
|
||||||
|
return unless dialog.contents
|
||||||
|
prompt, prompt_width, prompt_list = check_multiline_prompt(dialog.lines_backup[:lines], prompt)
|
||||||
visual_lines = []
|
visual_lines = []
|
||||||
visual_lines_under_dialog = []
|
visual_lines_under_dialog = []
|
||||||
visual_start = nil
|
visual_start = nil
|
||||||
@dialog_lines_backup[:lines].each_with_index { |l, i|
|
dialog.lines_backup[:lines].each_with_index { |l, i|
|
||||||
pr = prompt_list ? prompt_list[i] : prompt
|
pr = prompt_list ? prompt_list[i] : prompt
|
||||||
vl, _ = split_by_width(pr + l, @screen_size.last)
|
vl, _ = split_by_width(pr + l, @screen_size.last)
|
||||||
vl.compact!
|
vl.compact!
|
||||||
if i == @dialog_lines_backup[:line_index]
|
if i == dialog.lines_backup[:line_index]
|
||||||
visual_start = visual_lines.size + @dialog_lines_backup[:started_from] + @dialog_vertical_offset
|
visual_start = visual_lines.size + dialog.lines_backup[:started_from] + dialog.vertical_offset
|
||||||
end
|
end
|
||||||
visual_lines.concat(vl)
|
visual_lines.concat(vl)
|
||||||
}
|
}
|
||||||
visual_lines_under_dialog = visual_lines[visual_start, @dialog_contents.size]
|
visual_lines_under_dialog = visual_lines[visual_start, dialog.contents.size]
|
||||||
Reline::IOGate.hide_cursor
|
Reline::IOGate.hide_cursor
|
||||||
move_cursor_down(@dialog_vertical_offset)
|
move_cursor_down(dialog.vertical_offset)
|
||||||
dialog_vertical_size = @dialog_contents.size
|
dialog_vertical_size = dialog.contents.size
|
||||||
dialog_vertical_size.times do |i|
|
dialog_vertical_size.times do |i|
|
||||||
if i < visual_lines_under_dialog.size
|
if i < visual_lines_under_dialog.size
|
||||||
Reline::IOGate.move_cursor_column(0)
|
Reline::IOGate.move_cursor_column(0)
|
||||||
@output.write "\e[39m\e[49m%-#{DIALOG_WIDTH}s\e[39m\e[49m" % visual_lines_under_dialog[i]
|
@output.write "\e[39m\e[49m%-#{DIALOG_WIDTH}s\e[39m\e[49m" % visual_lines_under_dialog[i]
|
||||||
else
|
else
|
||||||
Reline::IOGate.move_cursor_column(@dialog_column)
|
Reline::IOGate.move_cursor_column(dialog.column)
|
||||||
@output.write "\e[39m\e[49m#{' ' * DIALOG_WIDTH}\e[39m\e[49m"
|
@output.write "\e[39m\e[49m#{' ' * DIALOG_WIDTH}\e[39m\e[49m"
|
||||||
end
|
end
|
||||||
Reline::IOGate.erase_after_cursor
|
Reline::IOGate.erase_after_cursor
|
||||||
move_cursor_down(1) if i < (dialog_vertical_size - 1)
|
move_cursor_down(1) if i < (dialog_vertical_size - 1)
|
||||||
end
|
end
|
||||||
move_cursor_up(dialog_vertical_size - 1 + @dialog_vertical_offset)
|
move_cursor_up(dialog_vertical_size - 1 + dialog.vertical_offset)
|
||||||
Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
|
Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
|
||||||
Reline::IOGate.show_cursor
|
Reline::IOGate.show_cursor
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue