reline 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reline/config.rb +6 -10
- data/lib/reline/key_actor/base.rb +0 -4
- data/lib/reline/line_editor.rb +1 -1
- data/lib/reline/version.rb +1 -1
- data/lib/reline.rb +9 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 590a83a7301ffc23869017938e580376b9e3025130ebb0f102fa47d5ac9be28f
|
4
|
+
data.tar.gz: 4652d400dba7e688591f1795e1c2a42b51ce4c9ad8381420c56e68c167034535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3272d6b13d84818a895910d2a0201fa1629ea0dfc71037904a9c5f862c277866780df9aad323a5898941c9f2162fa2684892451617b30e7b9ec637ec3c143d
|
7
|
+
data.tar.gz: 67004e4bf5b626ebf7d098750ffa7b198539ae8d344ad65b80f101faef0f0f57504e05cd2cd90a167feaea0f6a78c179abd1d698cecb29c290a7d2dbac3923ae
|
data/lib/reline/config.rb
CHANGED
@@ -69,17 +69,14 @@ class Reline::Config
|
|
69
69
|
@test_mode = false
|
70
70
|
@autocompletion = false
|
71
71
|
@convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding)
|
72
|
+
@loaded = false
|
72
73
|
end
|
73
74
|
|
74
75
|
def reset
|
75
76
|
if editing_mode_is?(:vi_command)
|
76
77
|
@editing_mode_label = :vi_insert
|
77
78
|
end
|
78
|
-
@additional_key_bindings.keys.each do |key|
|
79
|
-
@additional_key_bindings[key].clear
|
80
|
-
end
|
81
79
|
@oneshot_key_bindings.clear
|
82
|
-
reset_default_key_bindings
|
83
80
|
end
|
84
81
|
|
85
82
|
def editing_mode
|
@@ -98,6 +95,10 @@ class Reline::Config
|
|
98
95
|
@key_actors[@keymap_label]
|
99
96
|
end
|
100
97
|
|
98
|
+
def loaded?
|
99
|
+
@loaded
|
100
|
+
end
|
101
|
+
|
101
102
|
def inputrc_path
|
102
103
|
case ENV['INPUTRC']
|
103
104
|
when nil, ''
|
@@ -129,6 +130,7 @@ class Reline::Config
|
|
129
130
|
end
|
130
131
|
|
131
132
|
def read(file = nil)
|
133
|
+
@loaded = true
|
132
134
|
file ||= default_inputrc_path
|
133
135
|
begin
|
134
136
|
if file.respond_to?(:readlines)
|
@@ -171,12 +173,6 @@ class Reline::Config
|
|
171
173
|
@key_actors[@keymap_label].default_key_bindings[keystroke] = target
|
172
174
|
end
|
173
175
|
|
174
|
-
def reset_default_key_bindings
|
175
|
-
@key_actors.values.each do |ka|
|
176
|
-
ka.reset_default_key_bindings
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
176
|
def read_lines(lines, file = nil)
|
181
177
|
if not lines.empty? and lines.first.encoding != Reline.encoding_system_needs
|
182
178
|
begin
|
data/lib/reline/line_editor.rb
CHANGED
@@ -387,7 +387,7 @@ class Reline::LineEditor
|
|
387
387
|
next cached
|
388
388
|
end
|
389
389
|
*wrapped_prompts, code_line_prompt = split_by_width(prompt, width).first.compact
|
390
|
-
wrapped_lines = split_by_width(line, width, offset: calculate_width(code_line_prompt)).first.compact
|
390
|
+
wrapped_lines = split_by_width(line, width, offset: calculate_width(code_line_prompt, true)).first.compact
|
391
391
|
wrapped_prompts.map { |p| [p, ''] } + [[code_line_prompt, wrapped_lines.first]] + wrapped_lines.drop(1).map { |c| ['', c] }
|
392
392
|
end
|
393
393
|
end
|
data/lib/reline/version.rb
CHANGED
data/lib/reline.rb
CHANGED
@@ -225,17 +225,20 @@ module Reline
|
|
225
225
|
journey_data = completion_journey_data
|
226
226
|
return unless journey_data
|
227
227
|
|
228
|
-
target = journey_data.list
|
228
|
+
target = journey_data.list.first
|
229
|
+
completed = journey_data.list[journey_data.pointer]
|
229
230
|
result = journey_data.list.drop(1)
|
230
231
|
pointer = journey_data.pointer - 1
|
231
|
-
return if
|
232
|
+
return if completed.empty? || (result == [completed] && pointer < 0)
|
232
233
|
|
233
234
|
target_width = Reline::Unicode.calculate_width(target)
|
234
|
-
|
235
|
-
if x
|
236
|
-
|
235
|
+
completed_width = Reline::Unicode.calculate_width(completed)
|
236
|
+
if cursor_pos.x <= completed_width - target_width
|
237
|
+
# When target is rendered on the line above cursor position
|
238
|
+
x = screen_width - completed_width
|
237
239
|
y = -1
|
238
240
|
else
|
241
|
+
x = [cursor_pos.x - completed_width, 0].max
|
239
242
|
y = 0
|
240
243
|
end
|
241
244
|
cursor_pos_to_render = Reline::CursorPos.new(x, y)
|
@@ -335,9 +338,8 @@ module Reline
|
|
335
338
|
end
|
336
339
|
end
|
337
340
|
|
338
|
-
unless config.test_mode
|
341
|
+
unless config.test_mode or config.loaded?
|
339
342
|
config.read
|
340
|
-
config.reset_default_key_bindings
|
341
343
|
io_gate.set_default_key_bindings(config)
|
342
344
|
end
|
343
345
|
|
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.5.
|
4
|
+
version: 0.5.5
|
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-05-02 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.9
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Alternative GNU Readline or Editline implementation by pure Ruby.
|