[Reline::Unicode] Explicitly set join field so setting $, doesn't break it#866
Conversation
|
I think there are still more than 10 IRB depends on Reline, RDoc, PP, ReplTypeCompletor, RBS and more. Perhaps all gem's Another possible fix will be to set # Simplified code of IRB
def with_dollar_comma_nil
dollar_comma, $, = $, nil
yield
ensure
$, = dollar_comma
end
loop do
input = with_dollar_comma_nil { Reline.readline }
result = eval input
with_dollar_comma_nil { pp result }
end |
|
Yeah, when debugging the problem I noticed that there were quite a few .joins, but from my minimal testing it seems like this is the only place where it breaks things? I didn't do anything deeper than just experimenting, but this solves the issues I've been seeing forever (and only recently bothered to investigate!) We could change IRB instead, do you think that would make more sense? |
Actually, all # Rendering completion menu
require 'reline'
$, = '[FOOBAR]'
Reline.completion_proc = ->*{['aa', 'ab', 'ac']}
Reline.readline('>')
> # Press "a" and TAB
aa [FOOBAR]ab [FOOBAR]ac [FOOBAR][FOOBAR]...Changing |
This PR updates
Reline::Unicode.escape_for_printso it explicitly joins with'', instead of$,.Using
$,causes errors in IRB. For example, trying to typeputs "hi":Before
After