Skip to content

ed_quoted_insert doesn't work properly #321

@elfham

Description

@elfham

Description

ed_quoted_insert doesn't seem to work properly with some of keys.

("properly" means "different from same as readline 8.1")

Steps to Reproduce

Environment:

irb(main):001:0> irb_info
=>
Ruby version: 2.7.4
IRB version: irb 1.3.7 (2021-08-12)
InputMethod: ReidlineInputMethod with Reline 0.2.7
RUBY_PLATFORM: amd64-freebsd13
LANG env: ja_JP.UTF-8
  • no .irbrc, no .inputrc
  • PuTTYrv 0.76-ranvis2 (CJK)
  • Keyboard: US

Scenario:

Start irb --readline and type ", ", C-b.
The cursor is at the second ".

% irb --readline
irb(main):001:0" ""
                  _

Type C-v, C-a, Enter.

% irb --readline
irb(main):001:0> "^A"
=> "\u0001"
irb(main):002:0>

Do the same key operation on irb without --readline.

% irb
irb(main):001:0> "^A"
=> "\u0001"
irb(main):002:0>

Compare the input string "^A" and the output string "\u0001" with irb --readline.

Result:

HEX Chr key expected (readline) actual (Reline) OK/NG
00 NUL C-2 (see below) (see below) OK?
01 SOH C-a "^A" => "\u0001" "^A" => "\u0001" OK
02 STX C-b "^B" => "\u0002" "^B" => "\u0002" OK
03 ETX C-c "^C" => "\u0003" (see below) NG
04 EOT C-d "^D" => "\u0004" "^D" => "\u0004" OK
05 ENQ C-e "^E" => "\u0005" "^E" => "\u0005" OK
06 ACK C-f "^F" => "\u0006" "^F" => "\u0006" OK
07 BEL C-g "^G" => "\a" "^G" => "\a" OK
08 BS C-h "^H" => "\b" "^H" => "\b" OK
09 HT C-i (see below) (see below) NG
0A LF C-j (see below) (see below) OK?
0B VT C-k "^K" => "\v" "^K" => "\v" OK
0C FF C-l "^L" => "\f" "^L" => "\f" OK
0D CR C-m (see below) (see below) NG
0E SO C-n "^N" => "\u000E" "^N" => "\u000E" OK
0F SI C-o "^O" => "\u000F" "^O" => "\u000F" OK
10 DLE C-p "^P" => "\u0010" "^P" => "\u0010" OK
11 DC1 C-q "^Q" => "\u0011" "^Q" => "\u0011" OK
12 DC2 C-r "^R" => "\u0012" "^R" => "\u0012" OK
13 DC3 C-s "^S" => "\u0013" "^S" => "\u0013" OK
14 DC4 C-t "^T" => "\u0014" "^T" => "\u0014" OK
15 NAK C-u "^U" => "\u0015" "^U" => "\u0015" OK
16 SYN C-v "^V" => "\u0016" "^V" => "\u0016" OK
17 ETB C-w "^W" => "\u0017" "^W" => "\u0017" OK
18 CAN C-x "^X" => "\u0018" "^X" => "\u0018" OK
19 EM C-y "^Y" => "\u0019" "^Y" => "\u0019" OK
1A SUB C-z "^Z" => "\u001A" (see below) NG
1B ESC C-[, C-3 "^[" => "\e" "^[" => "\e" OK
1C FS C-\, C-4 "^\" => "\u001C" (see below) NG
1D GS C-], C-5 "^]" => "\u001D" "^]" => "\u001D" OK
1E RS C-6, S-C-6, S-C-' "^^" => "\u001E" "^^" => "" OK
1F US C-7, C-/, C--, S-C-- "^_" => "\u001F" "^_" => "\u001F" OK
7F DEL C-8 "^?" => "\u007F" "^?" => "\u007F" OK

C-2

Readline:

irb(main):001:0> ""
=> ""
irb(main):002:0>

Reline:

irb(main):001:0> "^@"
=> "\u0000"
irb(main):002:0>

Readline doesn't seem to be able to handle NUL, but Reline does.

C-c

Reline:

irb(main):001:0" ""
^C
irb(main):001:0>
irb(main):002:0>

C-c breaks the input.

C-i

Readline:

irb(main):001:0> "      "
=> "\t"
irb(main):002:0>

Reline:

irb(main):001:0> "
irb(main):002:0" "

Reline doesn't seem to be able to handle C-i.

C-j

Readline:

irb(main):001:0> "
"
=> "\n"
irb(main):003:0>

Reilne:

irb(main):001:0" "
irb(main):002:0> "
=> "\n"
irb(main):003:0>

The display is different, but it seems to work correctly.

C-m

Readline:

irb(main):001:0> "^M"
(irb):1: warning: encountered \r in middle of line, treated as a mere space
=> "\r"
irb(main):002:0>

Reline:

irb(main):001:0" "
irb(main):002:0> "
=> "\n"
irb(main):003:0>

C-z

Reline:

% irb
irb(main):001:0" ""
zsh: suspended  irb
% 
% 

irb goes to the background.

C-\, C-4

Reline:

irb(main):001:0> ""
zsh: quit (core dumped)  irb
% 

Bug of MRI ?

Terminal Emulator

PuTTYrv 0.76-ranvis2 (CJK)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions