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

[ruby/reline] Pass "dialog" to context to get "dialog.scroll_top" later

https://github.com/ruby/reline/commit/d81f29a134
This commit is contained in:
aycabta 2021-08-31 04:23:17 +09:00 committed by git
parent 32abd38014
commit c98b2e14c7
2 changed files with 10 additions and 1 deletions

View file

@ -220,7 +220,7 @@ module Reline
cursor_pos_to_render = Reline::CursorPos.new(x, y)
if context and context.is_a?(Array)
context.clear
context.push(cursor_pos_to_render, result, pointer)
context.push(cursor_pos_to_render, result, pointer, dialog)
end
DialogRenderInfo.new(pos: cursor_pos_to_render, contents: result, pointer: pointer, height: 15)
}

View file

@ -499,6 +499,14 @@ class Reline::LineEditor
@line_editor.call_completion_proc_with_checking_args(pre, target, post)
end
def set_dialog(dialog)
@dialog = dialog
end
def dialog
@dialog
end
def set_cursor_pos(col, row)
@cursor_pos.x = col
@cursor_pos.y = row
@ -544,6 +552,7 @@ class Reline::LineEditor
end
def call
@proc_scope.set_dialog(self)
@proc_scope.call
end
end