[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 <jean.boussier@gmail.com>
This commit is contained in:
parent
d10afe0357
commit
161545d55d
@ -68,7 +68,7 @@ class Reline::KillRing
|
|||||||
def append(string, before_p = false)
|
def append(string, before_p = false)
|
||||||
case @state
|
case @state
|
||||||
when State::FRESH, State::YANK
|
when State::FRESH, State::YANK
|
||||||
@ring << RingPoint.new(string)
|
@ring << RingPoint.new(+string)
|
||||||
@state = State::CONTINUED
|
@state = State::CONTINUED
|
||||||
when State::CONTINUED, State::PROCESSED
|
when State::CONTINUED, State::PROCESSED
|
||||||
if before_p
|
if before_p
|
||||||
|
@ -1256,7 +1256,7 @@ class Reline::LineEditor
|
|||||||
item_mbchars = item.grapheme_clusters
|
item_mbchars = item.grapheme_clusters
|
||||||
end
|
end
|
||||||
size = [memo_mbchars.size, item_mbchars.size].min
|
size = [memo_mbchars.size, item_mbchars.size].min
|
||||||
result = ''
|
result = +''
|
||||||
size.times do |i|
|
size.times do |i|
|
||||||
if @config.completion_ignore_case
|
if @config.completion_ignore_case
|
||||||
if memo_mbchars[i].casecmp?(item_mbchars[i])
|
if memo_mbchars[i].casecmp?(item_mbchars[i])
|
||||||
@ -2935,7 +2935,7 @@ class Reline::LineEditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
private def ed_delete_prev_char(key, arg: 1)
|
private def ed_delete_prev_char(key, arg: 1)
|
||||||
deleted = ''
|
deleted = +''
|
||||||
arg.times do
|
arg.times do
|
||||||
if @cursor > 0
|
if @cursor > 0
|
||||||
byte_size = Reline::Unicode.get_prev_mbchar_size(@line, @byte_pointer)
|
byte_size = Reline::Unicode.get_prev_mbchar_size(@line, @byte_pointer)
|
||||||
|
@ -85,7 +85,7 @@ class Reline::Windows
|
|||||||
def call(*args)
|
def call(*args)
|
||||||
import = @proto.split("")
|
import = @proto.split("")
|
||||||
args.each_with_index do |x, i|
|
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"
|
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
|
||||||
end
|
end
|
||||||
ret, = @func.call(*args)
|
ret, = @func.call(*args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user