summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-08-31 04:23:17 +0900
committergit <svn-admin@ruby-lang.org>2021-08-31 05:26:53 +0900
commitc98b2e14c71022ca46999a26fbde9668440c4347 (patch)
treedccbe0d40ea6095f1eff580058a1ac4b84949b0c
parent32abd3801482d9bc9388a1e901b2cbd31435cb99 (diff)
[ruby/reline] Pass "dialog" to context to get "dialog.scroll_top" later
https://github.com/ruby/reline/commit/d81f29a134
-rw-r--r--lib/reline.rb2
-rw-r--r--lib/reline/line_editor.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/reline.rb b/lib/reline.rb
index fd36042d5f..cf668c79e3 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -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)
}
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 321ad91e50..fedbd94532 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -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