irb icon indicating copy to clipboard operation
irb copied to clipboard

IRB leaking out Reline changes globally

Open szymonj99 opened this issue 10 months ago • 0 comments

Description

Calling to IRB.start results in IRB leaking out Reline changes globally.

Minimal Reproducible Example

require 'reline'
require 'irb'

::Reline.autocompletion = false

line = ::Reline.readline('PROMPT >> ', false)

IRB.start

line = ::Reline.readline('PROMPT >> ', false)

Current Workaround

I'm unsure if there's any other potential settings being changed. Here's what I have so far:

config = { autocompletion: Reline.autocompletion, core: Reline.core.dup }
IRB.start
Reline.autocompletion = config[:autocompletion]
Reline.instance_variable_set(:@core, @current_config[:core])

Expected Behaviour

I would expect that changes to Reline performed by IRB do not persist after quitting out of the IRB session. My Reline changes and settings should remain what the were before and after.

Result of irb_info

irb(main):001> irb_info
Ruby version: 3.3.6
IRB version: irb 1.14.1 (2024-09-25)
InputMethod: RelineInputMethod with Reline 0.5.12
Completion: Autocomplete, RegexpCompletor
RUBY_PLATFORM: x86_64-linux
LANG env: en_GB.UTF-8
East Asian Ambiguous Width: 1

Terminal Emulator

Konsole. This happens on a Mac as well with the default terminal.

Setting Files

Are you using ~/.irbrc and ~/.inputrc? -> No

szymonj99 avatar Dec 13 '24 00:12 szymonj99