reline 0.4.3 → 0.5.0
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/ansi.rb +2 -0
- data/lib/reline/general_io.rb +3 -9
- data/lib/reline/kill_ring.rb +1 -1
- data/lib/reline/line_editor.rb +594 -1299
- data/lib/reline/version.rb +1 -1
- data/lib/reline/windows.rb +3 -1
- data/lib/reline.rb +21 -22
- metadata +3 -3
data/lib/reline/version.rb
CHANGED
data/lib/reline/windows.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'fiddle/import'
|
2
2
|
|
3
3
|
class Reline::Windows
|
4
|
+
RESET_COLOR = "\e[0m"
|
5
|
+
|
4
6
|
def self.encoding
|
5
7
|
Encoding::UTF_8
|
6
8
|
end
|
@@ -85,7 +87,7 @@ class Reline::Windows
|
|
85
87
|
def call(*args)
|
86
88
|
import = @proto.split("")
|
87
89
|
args.each_with_index do |x, i|
|
88
|
-
args[i], = [x == 0 ? nil : x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
|
90
|
+
args[i], = [x == 0 ? nil : +x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
|
89
91
|
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
|
90
92
|
end
|
91
93
|
ret, = @func.call(*args)
|
data/lib/reline.rb
CHANGED
@@ -78,7 +78,6 @@ module Reline
|
|
78
78
|
@dialog_proc_list = {}
|
79
79
|
yield self
|
80
80
|
@completion_quote_character = nil
|
81
|
-
@bracketed_paste_finished = false
|
82
81
|
end
|
83
82
|
|
84
83
|
def io_gate
|
@@ -278,8 +277,13 @@ module Reline
|
|
278
277
|
Reline::HISTORY << whole_buffer
|
279
278
|
end
|
280
279
|
|
281
|
-
|
282
|
-
|
280
|
+
if line_editor.eof?
|
281
|
+
line_editor.reset_line
|
282
|
+
# Return nil if the input is aborted by C-d.
|
283
|
+
nil
|
284
|
+
else
|
285
|
+
whole_buffer
|
286
|
+
end
|
283
287
|
end
|
284
288
|
end
|
285
289
|
|
@@ -326,9 +330,11 @@ module Reline
|
|
326
330
|
line_editor.prompt_proc = prompt_proc
|
327
331
|
line_editor.auto_indent_proc = auto_indent_proc
|
328
332
|
line_editor.dig_perfect_match_proc = dig_perfect_match_proc
|
329
|
-
|
330
|
-
|
331
|
-
|
333
|
+
pre_input_hook&.call
|
334
|
+
unless Reline::IOGate == Reline::GeneralIO
|
335
|
+
@dialog_proc_list.each_pair do |name_sym, d|
|
336
|
+
line_editor.add_dialog_proc(name_sym, d.dialog_proc, d.context)
|
337
|
+
end
|
332
338
|
end
|
333
339
|
|
334
340
|
unless config.test_mode
|
@@ -337,30 +343,24 @@ module Reline
|
|
337
343
|
io_gate.set_default_key_bindings(config)
|
338
344
|
end
|
339
345
|
|
346
|
+
line_editor.print_nomultiline_prompt(prompt)
|
347
|
+
line_editor.update_dialogs
|
340
348
|
line_editor.rerender
|
341
349
|
|
342
350
|
begin
|
343
351
|
line_editor.set_signal_handlers
|
344
|
-
prev_pasting_state = false
|
345
352
|
loop do
|
346
|
-
prev_pasting_state = io_gate.in_pasting?
|
347
353
|
read_io(config.keyseq_timeout) { |inputs|
|
348
354
|
line_editor.set_pasting_state(io_gate.in_pasting?)
|
349
|
-
inputs.each { |
|
350
|
-
line_editor.input_key(c)
|
351
|
-
line_editor.rerender
|
352
|
-
}
|
353
|
-
if @bracketed_paste_finished
|
354
|
-
line_editor.rerender_all
|
355
|
-
@bracketed_paste_finished = false
|
356
|
-
end
|
355
|
+
inputs.each { |key| line_editor.update(key) }
|
357
356
|
}
|
358
|
-
if
|
359
|
-
line_editor.
|
360
|
-
|
361
|
-
|
357
|
+
if line_editor.finished?
|
358
|
+
line_editor.render_finished
|
359
|
+
break
|
360
|
+
else
|
361
|
+
line_editor.set_pasting_state(io_gate.in_pasting?)
|
362
|
+
line_editor.rerender
|
362
363
|
end
|
363
|
-
break if line_editor.finished?
|
364
364
|
end
|
365
365
|
io_gate.move_cursor_column(0)
|
366
366
|
rescue Errno::EIO
|
@@ -395,7 +395,6 @@ module Reline
|
|
395
395
|
c = io_gate.getc(Float::INFINITY)
|
396
396
|
if c == -1
|
397
397
|
result = :unmatched
|
398
|
-
@bracketed_paste_finished = true
|
399
398
|
else
|
400
399
|
buffer << c
|
401
400
|
result = key_stroke.match_status(buffer)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aycabta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: io-console
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.5.
|
79
|
+
rubygems_version: 3.5.3
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Alternative GNU Readline or Editline implementation by pure Ruby.
|