Skip to content

Reline crash with C-v C-k and any alphabet #625

Closed

Description

@tompng

Description

IRB crash with C-v C-k (to input "\v") then press any alphabet

Actual error

# `irb --autocomplete` with `C-vC-kaa`
/Users/tomoya.ishida/.rbenv/versions/3.3.0/lib/ruby/3.3.0/reline/line_editor.rb:1754:in `retrieve_completion_block': undefined method `encode' for nil (NoMethodError)

    [preposing.encode(@encoding), target.encode(@encoding), postposing.encode(@encoding)]
                                                                      ^^^^^^^
	from /Users/tomoya.ishida/.rbenv/versions/3.3.0/lib/ruby/3.3.0/reline/line_editor.rb:529:in `retrieve_completion_block'
# `irb --noautocomplete` with `C-vC-kaa`
/Users/tomoya.ishida/.rbenv/versions/3.3.0/lib/ruby/3.3.0/reline/line_editor.rb:1880:in `byteinsert': no implicit conversion of nil into String (TypeError)

    new_str << str.byteslice(byte_pointer, str.bytesize)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	from /Users/tomoya.ishida/.rbenv/versions/3.3.0/lib/ruby/3.3.0/reline/line_editor.rb:1972:in `ed_insert'

Input that make IRB crash

# vi-mode
# irb --autocomplete
C-k a
# irb --noautocomplete
C-k a a

# emacs-mode
# irb --autocomplete
C-v C-k a
# irb --noautocomplete
C-v C-k a a

# older version of irb and reline (ruby-3.0.6 irb-1.3.5, reline-0.2.5)
input: "(\n\C-v\C-k)a"
error:
/Users/tomoya.ishida/.rbenv/versions/3.0.6/lib/ruby/3.0.0/reline/line_editor.rb:1435:in `byteinsert': no implicit conversion of nil into String (TypeError)
	from /Users/tomoya.ishida/.rbenv/versions/3.0.6/lib/ruby/3.0.0/reline/line_editor.rb:1510:in `ed_insert'

Caused by @bytepointer overrun with autoindent

Reline version

0.2.5, 0.4.1, 0.5.0.pre.1

Terminal Emulator

What's your terminal emulator?
Terminal.app. (any termninal)

Activity

  1. added
    bug
    on Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions