Class: Reline::LineEditor::DialogProcScope

Inherits:
Object
  • Object
show all
Defined in:
lib/reline/line_editor.rb

Defined Under Namespace

Classes: CompletionJourneyData

Instance Method Summary collapse

Constructor Details

#initialize(line_editor, config, proc_to_exec, context) ⇒ DialogProcScope

Returns a new instance of DialogProcScope.



561
562
563
564
565
566
567
# File 'lib/reline/line_editor.rb', line 561

def initialize(line_editor, config, proc_to_exec, context)
  @line_editor = line_editor
  @config = config
  @proc_to_exec = proc_to_exec
  @context = context
  @cursor_pos = Reline::CursorPos.new
end

Instance Method Details

#callObject



631
632
633
# File 'lib/reline/line_editor.rb', line 631

def call
  instance_exec(&@proc_to_exec)
end

#call_completion_proc_with_checking_args(pre, target, post) ⇒ Object



577
578
579
# File 'lib/reline/line_editor.rb', line 577

def call_completion_proc_with_checking_args(pre, target, post)
  @line_editor.call_completion_proc_with_checking_args(pre, target, post)
end

#completion_journey_dataObject



623
624
625
# File 'lib/reline/line_editor.rb', line 623

def completion_journey_data
  @line_editor.dialog_proc_scope_completion_journey_data
end

#configObject



627
628
629
# File 'lib/reline/line_editor.rb', line 627

def config
  @config
end

#contextObject



569
570
571
# File 'lib/reline/line_editor.rb', line 569

def context
  @context
end

#cursor_posObject



602
603
604
# File 'lib/reline/line_editor.rb', line 602

def cursor_pos
  @cursor_pos
end

#dialogObject



585
586
587
# File 'lib/reline/line_editor.rb', line 585

def dialog
  @dialog
end

#just_cursor_movingObject



606
607
608
# File 'lib/reline/line_editor.rb', line 606

def just_cursor_moving
  @line_editor.instance_variable_get(:@just_cursor_moving)
end

#keyObject



598
599
600
# File 'lib/reline/line_editor.rb', line 598

def key
  @key
end

#preferred_dialog_heightObject



618
619
620
621
# File 'lib/reline/line_editor.rb', line 618

def preferred_dialog_height
  _wrapped_cursor_x, wrapped_cursor_y = @line_editor.wrapped_cursor_position
  [@line_editor.upper_space_height(wrapped_cursor_y), @line_editor.rest_height(wrapped_cursor_y), (screen_height + 6) / 5].max
end

#retrieve_completion_block(set_completion_quote_character = false) ⇒ Object



573
574
575
# File 'lib/reline/line_editor.rb', line 573

def retrieve_completion_block(set_completion_quote_character = false)
  @line_editor.retrieve_completion_block(set_completion_quote_character)
end

#screen_heightObject



614
615
616
# File 'lib/reline/line_editor.rb', line 614

def screen_height
  @line_editor.screen_height
end

#screen_widthObject



610
611
612
# File 'lib/reline/line_editor.rb', line 610

def screen_width
  @line_editor.screen_width
end

#set_cursor_pos(col, row) ⇒ Object



589
590
591
592
# File 'lib/reline/line_editor.rb', line 589

def set_cursor_pos(col, row)
  @cursor_pos.x = col
  @cursor_pos.y = row
end

#set_dialog(dialog) ⇒ Object



581
582
583
# File 'lib/reline/line_editor.rb', line 581

def set_dialog(dialog)
  @dialog = dialog
end

#set_key(key) ⇒ Object



594
595
596
# File 'lib/reline/line_editor.rb', line 594

def set_key(key)
  @key = key
end