Module: Reline
- Extended by:
- Forwardable, SingleForwardable
- Defined in:
- lib/reline.rb,
lib/reline/io.rb,
lib/reline/version.rb
Defined Under Namespace
Modules: KeyActor Classes: ANSI, Config, ConfigEncodingConversionError, Core, CursorPos, DialogRenderInfo, Dumb, Face, History, IO, Key, KeyStroke, KillRing, LineEditor, Unicode, Windows
Constant Summary collapse
- FILENAME_COMPLETION_PROC =
NOTE: For making compatible with the rb-readline gem
nil
- USERNAME_COMPLETION_PROC =
:nodoc:
nil
- DEFAULT_DIALOG_PROC_AUTOCOMPLETE =
->() { # autocomplete return unless config.autocompletion journey_data = completion_journey_data return unless journey_data target = journey_data.list.first completed = journey_data.list[journey_data.pointer] result = journey_data.list.drop(1) pointer = journey_data.pointer - 1 return if completed.empty? || (result == [completed] && pointer < 0) target_width = Reline::Unicode.calculate_width(target) completed_width = Reline::Unicode.calculate_width(completed) if cursor_pos.x <= completed_width - target_width # When target is rendered on the line above cursor position x = screen_width - completed_width y = -1 else x = [cursor_pos.x - completed_width, 0].max y = 0 end 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, dialog) end dialog.pointer = pointer DialogRenderInfo.new( pos: cursor_pos_to_render, contents: result, scrollbar: true, height: [15, preferred_dialog_height].min, face: :completion_dialog ) }
- DEFAULT_DIALOG_CONTEXT =
:nodoc:
Array.new
- IOGate =
Reline::IO.decide_io_gate
- GeneralIO =
Deprecated
Reline::Dumb.new
- HISTORY =
Reline::History.new(Reline.core.config)
- VERSION =
'0.6.1'
Class Method Summary collapse
- .core ⇒ Object
-
.encoding_system_needs ⇒ Object
:nodoc:.
- .insert_text(text) ⇒ Object
- .line_editor ⇒ Object
- .ungetc(c) ⇒ Object
Instance Method Summary collapse
-
#core ⇒ Object
:singleton-method: readline :call-seq: readline(prompt = ”, add_hist = false) -> string or nil.
Class Method Details
.core ⇒ Object
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/reline.rb', line 495 def self.core @core ||= Core.new { |core| core.config = Reline::Config.new core.key_stroke = Reline::KeyStroke.new(core.config, core.encoding) core.line_editor = Reline::LineEditor.new(core.config) core.basic_word_break_characters = " \t\n`><=;|&{(" core.completer_word_break_characters = " \t\n`><=;|&{(" core.basic_quote_characters = '"\'' core.completer_quote_characters = '"\'' core.filename_quote_characters = "" core.special_prefixes = "" core.add_dialog_proc(:autocomplete, Reline::DEFAULT_DIALOG_PROC_AUTOCOMPLETE, Reline::DEFAULT_DIALOG_CONTEXT) } end |
.encoding_system_needs ⇒ Object
:nodoc:
491 492 493 |
# File 'lib/reline.rb', line 491 def self.encoding_system_needs # :nodoc: self.core.encoding end |
.insert_text(text) ⇒ Object
473 474 475 476 |
# File 'lib/reline.rb', line 473 def self.insert_text(text) line_editor.insert_multiline_text(text) self end |
.line_editor ⇒ Object
515 516 517 |
# File 'lib/reline.rb', line 515 def self.line_editor core.line_editor end |
.ungetc(c) ⇒ Object
511 512 513 |
# File 'lib/reline.rb', line 511 def self.ungetc(c) core.io_gate.ungetc(c) end |
Instance Method Details
#core ⇒ Object
:singleton-method: readline :call-seq:
readline(prompt = '', add_hist = false) -> string or nil
447 |
# File 'lib/reline.rb', line 447 def_single_delegators :core, :readmultiline |