Project

General

Profile

Actions

Bug #20711

closed

readline/reline duplicate display of prompt

Added by yogo1212 (Leon Busch-George) 4 months ago. Updated about 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [x86_64-linux]
[ruby-core:119022]

Description

#!/usr/bin/env ruby

require 'readline'

prompt = "asdf: "
default = "true"

Readline.pre_input_hook = -> do
	Readline.insert_text "#{default}"
	Readline.redisplay
	Readline.pre_input_hook = nil
end

Readline.readline(prompt)
prompt: trueprompt:

the cursor sits at the right place (behind the 'e' in 'true'). inserting a backslash causes the line to be cleared and fixes the display.

expected display, correct in previous versions:

prompt: true

affected:

ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [x86_64-linux] # from rbenv

unaffected:

ruby 3.0.7p220 (2024-04-23 revision 724a071175) [x86_64-linux] # RHEL 9
ruby 3.2.5 (2024-07-26 revision 31d0f1a2e7) [x86_64-linux] # Arch Linux package
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0