Skip to content

Commit d81f29a

Browse files
committed
Pass "dialog" to context to get "dialog.scroll_top" later
1 parent 7e18716 commit d81f29a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/reline.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def get_screen_size
220220
cursor_pos_to_render = Reline::CursorPos.new(x, y)
221221
if context and context.is_a?(Array)
222222
context.clear
223-
context.push(cursor_pos_to_render, result, pointer)
223+
context.push(cursor_pos_to_render, result, pointer, dialog)
224224
end
225225
DialogRenderInfo.new(pos: cursor_pos_to_render, contents: result, pointer: pointer, height: 15)
226226
}

lib/reline/line_editor.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,14 @@ def call_completion_proc_with_checking_args(pre, target, post)
499499
@line_editor.call_completion_proc_with_checking_args(pre, target, post)
500500
end
501501

502+
def set_dialog(dialog)
503+
@dialog = dialog
504+
end
505+
506+
def dialog
507+
@dialog
508+
end
509+
502510
def set_cursor_pos(col, row)
503511
@cursor_pos.x = col
504512
@cursor_pos.y = row
@@ -544,6 +552,7 @@ def set_cursor_pos(col, row)
544552
end
545553

546554
def call
555+
@proc_scope.set_dialog(self)
547556
@proc_scope.call
548557
end
549558
end

0 commit comments

Comments
 (0)