reline 0.5.12 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/reline/io/ansi.rb +44 -36
- data/lib/reline/io/dumb.rb +11 -0
- data/lib/reline/io/windows.rb +11 -1
- data/lib/reline/io.rb +14 -0
- data/lib/reline/key_actor/base.rb +10 -4
- data/lib/reline/key_actor/emacs.rb +96 -96
- data/lib/reline/key_actor/vi_command.rb +182 -182
- data/lib/reline/key_actor/vi_insert.rb +137 -137
- data/lib/reline/key_stroke.rb +10 -11
- data/lib/reline/line_editor.rb +153 -250
- data/lib/reline/unicode/east_asian_width.rb +41 -15
- data/lib/reline/unicode.rb +102 -348
- data/lib/reline/version.rb +1 -1
- data/lib/reline.rb +34 -25
- metadata +3 -4
data/lib/reline.rb
CHANGED
@@ -12,18 +12,20 @@ require 'rbconfig'
|
|
12
12
|
|
13
13
|
module Reline
|
14
14
|
# NOTE: For making compatible with the rb-readline gem
|
15
|
-
FILENAME_COMPLETION_PROC = nil
|
16
|
-
USERNAME_COMPLETION_PROC = nil
|
15
|
+
FILENAME_COMPLETION_PROC = nil # :nodoc:
|
16
|
+
USERNAME_COMPLETION_PROC = nil # :nodoc:
|
17
17
|
|
18
|
-
class ConfigEncodingConversionError < StandardError; end
|
18
|
+
class ConfigEncodingConversionError < StandardError; end # :nodoc:
|
19
19
|
|
20
|
-
|
20
|
+
# EOF key: { char: nil, method_symbol: nil }
|
21
|
+
# Other key: { char: String, method_symbol: Symbol }
|
22
|
+
Key = Struct.new(:char, :method_symbol, :unused_boolean) do
|
21
23
|
# For dialog_proc `key.match?(dialog.name)`
|
22
24
|
def match?(sym)
|
23
|
-
|
25
|
+
method_symbol && method_symbol == sym
|
24
26
|
end
|
25
|
-
end
|
26
|
-
CursorPos = Struct.new(:x, :y)
|
27
|
+
end # :nodoc:
|
28
|
+
CursorPos = Struct.new(:x, :y) # :nodoc:
|
27
29
|
DialogRenderInfo = Struct.new(
|
28
30
|
:pos,
|
29
31
|
:contents,
|
@@ -33,7 +35,7 @@ module Reline
|
|
33
35
|
:height,
|
34
36
|
:scrollbar,
|
35
37
|
keyword_init: true
|
36
|
-
)
|
38
|
+
) # :nodoc:
|
37
39
|
|
38
40
|
class Core
|
39
41
|
ATTR_READER_NAMES = %i(
|
@@ -181,9 +183,7 @@ module Reline
|
|
181
183
|
def output=(val)
|
182
184
|
raise TypeError unless val.respond_to?(:write) or val.nil?
|
183
185
|
@output = val
|
184
|
-
|
185
|
-
io_gate.output = val
|
186
|
-
end
|
186
|
+
io_gate.output = val
|
187
187
|
end
|
188
188
|
|
189
189
|
def vi_editing_mode
|
@@ -244,8 +244,8 @@ module Reline
|
|
244
244
|
height: [15, preferred_dialog_height].min,
|
245
245
|
face: :completion_dialog
|
246
246
|
)
|
247
|
-
}
|
248
|
-
Reline::DEFAULT_DIALOG_CONTEXT = Array.new
|
247
|
+
} # :nodoc:
|
248
|
+
Reline::DEFAULT_DIALOG_CONTEXT = Array.new # :nodoc:
|
249
249
|
|
250
250
|
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
|
251
251
|
@mutex.synchronize do
|
@@ -317,7 +317,6 @@ module Reline
|
|
317
317
|
else
|
318
318
|
line_editor.multiline_off
|
319
319
|
end
|
320
|
-
line_editor.output = output
|
321
320
|
line_editor.completion_proc = completion_proc
|
322
321
|
line_editor.completion_append_character = completion_append_character
|
323
322
|
line_editor.output_modifier_proc = output_modifier_proc
|
@@ -342,22 +341,22 @@ module Reline
|
|
342
341
|
line_editor.set_signal_handlers
|
343
342
|
loop do
|
344
343
|
read_io(config.keyseq_timeout) { |inputs|
|
345
|
-
line_editor.set_pasting_state(io_gate.in_pasting?)
|
346
344
|
inputs.each do |key|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
345
|
+
case key.method_symbol
|
346
|
+
when :bracketed_paste_start
|
347
|
+
# io_gate is Reline::ANSI because the key :bracketed_paste_start is only assigned in Reline::ANSI
|
348
|
+
key = Reline::Key.new(io_gate.read_bracketed_paste, :insert_multiline_text)
|
349
|
+
when :quoted_insert, :ed_quoted_insert
|
350
|
+
key = Reline::Key.new(io_gate.read_single_char(config.keyseq_timeout), :insert_raw_char)
|
353
351
|
end
|
352
|
+
line_editor.set_pasting_state(io_gate.in_pasting?)
|
353
|
+
line_editor.update(key)
|
354
354
|
end
|
355
355
|
}
|
356
356
|
if line_editor.finished?
|
357
357
|
line_editor.render_finished
|
358
358
|
break
|
359
359
|
else
|
360
|
-
line_editor.set_pasting_state(io_gate.in_pasting?)
|
361
360
|
line_editor.rerender
|
362
361
|
end
|
363
362
|
end
|
@@ -440,6 +439,17 @@ module Reline
|
|
440
439
|
}
|
441
440
|
def_single_delegators :core, :input=, :output=
|
442
441
|
def_single_delegators :core, :vi_editing_mode, :emacs_editing_mode
|
442
|
+
|
443
|
+
##
|
444
|
+
# :singleton-method: readmultiline
|
445
|
+
# :call-seq:
|
446
|
+
# readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination) -> string or nil
|
447
|
+
def_single_delegators :core, :readmultiline
|
448
|
+
|
449
|
+
##
|
450
|
+
# :singleton-method: readline
|
451
|
+
# :call-seq:
|
452
|
+
# readline(prompt = '', add_hist = false) -> string or nil
|
443
453
|
def_single_delegators :core, :readline
|
444
454
|
def_single_delegators :core, :completion_case_fold, :completion_case_fold=
|
445
455
|
def_single_delegators :core, :completion_quote_character
|
@@ -475,11 +485,10 @@ module Reline
|
|
475
485
|
def_single_delegators :core, :dialog_proc
|
476
486
|
def_single_delegators :core, :autocompletion, :autocompletion=
|
477
487
|
|
478
|
-
def_single_delegators :core, :readmultiline
|
479
488
|
def_instance_delegators self, :readmultiline
|
480
489
|
private :readmultiline
|
481
490
|
|
482
|
-
def self.encoding_system_needs
|
491
|
+
def self.encoding_system_needs # :nodoc:
|
483
492
|
self.core.encoding
|
484
493
|
end
|
485
494
|
|
@@ -512,7 +521,7 @@ end
|
|
512
521
|
Reline::IOGate = Reline::IO.decide_io_gate
|
513
522
|
|
514
523
|
# Deprecated
|
515
|
-
Reline::GeneralIO = Reline::Dumb.new
|
524
|
+
Reline::GeneralIO = Reline::Dumb.new # :nodoc:
|
516
525
|
|
517
526
|
Reline::Face.load_initial_configs
|
518
527
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
|
-
original_platform: ''
|
7
6
|
authors:
|
8
7
|
- aycabta
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-04-04 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: io-console
|
@@ -76,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
75
|
- !ruby/object:Gem::Version
|
77
76
|
version: '0'
|
78
77
|
requirements: []
|
79
|
-
rubygems_version: 3.6.
|
78
|
+
rubygems_version: 3.6.3
|
80
79
|
specification_version: 4
|
81
80
|
summary: Alternative GNU Readline or Editline implementation by pure Ruby.
|
82
81
|
test_files: []
|