ruby-changes:67374
From: aycabta <ko1@a...>
Date: Tue, 31 Aug 2021 05:27:06 +0900 (JST)
Subject: [ruby-changes:67374] c98b2e14c7 (master): [ruby/reline] Pass "dialog" to context to get "dialog.scroll_top" later
https://git.ruby-lang.org/ruby.git/commit/?id=c98b2e14c7 From c98b2e14c71022ca46999a26fbde9668440c4347 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Tue, 31 Aug 2021 04:23:17 +0900 Subject: [ruby/reline] Pass "dialog" to context to get "dialog.scroll_top" later https://github.com/ruby/reline/commit/d81f29a134 --- lib/reline.rb | 2 +- lib/reline/line_editor.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/reline.rb b/lib/reline.rb index fd36042..cf668c7 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -220,7 +220,7 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L220 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 321ad91..fedbd94 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -499,6 +499,14 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L499 @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 https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L552 end def call + @proc_scope.set_dialog(self) @proc_scope.call end end -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/