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.



578
579
580
581
582
583
584
# File 'lib/reline/line_editor.rb', line 578

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



649
650
651
# File 'lib/reline/line_editor.rb', line 649

def call
  instance_exec(&@proc_to_exec)
end

#call_completion_proc_with_checking_args(pre, target, post) ⇒ Object



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

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



641
642
643
# File 'lib/reline/line_editor.rb', line 641

def completion_journey_data
  @line_editor.dialog_proc_scope_completion_journey_data
end

#configObject



645
646
647
# File 'lib/reline/line_editor.rb', line 645

def config
  @config
end

#contextObject



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

def context
  @context
end

#cursor_posObject



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

def cursor_pos
  @cursor_pos
end

#dialogObject



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

def dialog
  @dialog
end

#just_cursor_movingObject



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

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

#keyObject



616
617
618
# File 'lib/reline/line_editor.rb', line 616

def key
  @key
end

#preferred_dialog_heightObject



636
637
638
639
# File 'lib/reline/line_editor.rb', line 636

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(_unused = false) ⇒ Object



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

def retrieve_completion_block(_unused = false)
  preposing, target, postposing, _quote = @line_editor.retrieve_completion_block
  [preposing, target, postposing]
end

#screen_heightObject



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

def screen_height
  @line_editor.screen_height
end

#screen_widthObject



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

def screen_width
  @line_editor.screen_width
end

#set_cursor_pos(col, row) ⇒ Object



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

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

#set_dialog(dialog) ⇒ Object



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

def set_dialog(dialog)
  @dialog = dialog
end

#set_key(key) ⇒ Object



612
613
614
# File 'lib/reline/line_editor.rb', line 612

def set_key(key)
  @key = key
end