summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean byroot Boussier <[email protected]>2024-03-14 17:09:03 +0100
committergit <[email protected]>2024-03-14 16:09:12 +0000
commit161545d55d894f42535fa5de7ac19cfb57122a2d (patch)
treebff9a6341e387f21964fbfbe134a2fa9711e9d28
parentd10afe03575446fa8d561fdc21ca3bed90df6e94 (diff)
[ruby/reline] Ensure compatibility with frozen string literals
(https://github.com/ruby/reline/pull/643) Ref: https://bugs.ruby-lang.org/issues/20205 Ruby is moving forward with enabling frozen string literals in the future. Reline being part of the ruby-core test suite should work when ruby is ran with `--enable-frozen-string-literal`. https://github.com/ruby/reline/commit/7e2de64cf0 Co-authored-by: Jean Boussier <[email protected]>
-rw-r--r--lib/reline/kill_ring.rb2
-rw-r--r--lib/reline/line_editor.rb4
-rw-r--r--lib/reline/windows.rb2
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/reline/kill_ring.rb b/lib/reline/kill_ring.rb
index 84d94a7ff6..201f6f3ca0 100644
--- a/lib/reline/kill_ring.rb
+++ b/lib/reline/kill_ring.rb
@@ -68,7 +68,7 @@ class Reline::KillRing
def append(string, before_p = false)
case @state
when State::FRESH, State::YANK
- @ring << RingPoint.new(string)
+ @ring << RingPoint.new(+string)
@state = State::CONTINUED
when State::CONTINUED, State::PROCESSED
if before_p
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index b7cc6b747d..5e3a862cc6 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1256,7 +1256,7 @@ class Reline::LineEditor
item_mbchars = item.grapheme_clusters
end
size = [memo_mbchars.size, item_mbchars.size].min
- result = ''
+ result = +''
size.times do |i|
if @config.completion_ignore_case
if memo_mbchars[i].casecmp?(item_mbchars[i])
@@ -2935,7 +2935,7 @@ class Reline::LineEditor
end
private def ed_delete_prev_char(key, arg: 1)
- deleted = ''
+ deleted = +''
arg.times do
if @cursor > 0
byte_size = Reline::Unicode.get_prev_mbchar_size(@line, @byte_pointer)
diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index 6f635f630f..a22331fae5 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -85,7 +85,7 @@ class Reline::Windows
def call(*args)
import = @proto.split("")
args.each_with_index do |x, i|
- args[i], = [x == 0 ? nil : x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
+ args[i], = [x == 0 ? nil : +x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
end
ret, = @func.call(*args)