IRB leaking out Reline changes globally

未关闭
#1,048 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
cli

调研方向

首先使用提供的 IRB.start 和 Reline.readline 序列重现该问题,然后跟踪 IRB 在会话期间及会话结束后如何更改 Reline 的状态。比较退出 IRB 前后的 Reline 设置,包括自动补全和核心状态。完成的标准是 IRB.start 返回后,原始的 Reline 设置仍保持不变。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Ruby
星标
477
派生
165
平均合并
1 天 19 小时
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/irb 的其他 Issue

查看 ruby/irb 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。