8000 Crash in vim mode when cursor is at the end of line · Issue #12430 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Crash in vim mode when cursor is at the end of line #12430

@nkitsaini

Description

@nkitsaini
Fish Version: 4.4.0
Operating System: Linux
Terminal: Ghostty 

Reproduction:

  1. Start fish with vim keybindings enabled
  2. Type any character such that fish will trigger suggestion
  3. Press l to accept the suggestion. This will move your cursor to the end of line. It actually goes 1 character past the line (which what is believe is causing the panic).
  4. Press ciw to change the the current word
  5. Panics

Some observations:

  1. You do not need to trigger suggestion. For example, if ls is in fish history you can:
    • Type ls manually
    • Press Esc to go into normal mode
    • Press l until you go past the (the terminal will look like this ls█)
    • Press ciw
  2. If the command you've typed is not in the fish_history, you can't go past the line (by pressing l) hence can't trigger the panic.
  3. I could not find a way to reproduce without vim mode.

Asciinema recording: https://asciinema.org/a/f8fVpU98KLFgKg1Z

Stacktrace

❮ sh -c 'env HOME=$(mktemp -d) XDG_CONFIG_HOME= XDG_DATA_DIRS= RUST_BACKTRACE=full fish -C "if status is-interactive
      fish_vi_key_bindings
  end
  "'
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
[N] kit@monkey /h/kit> ls
thread 'main' (811482) panicked at src/reader/reader.rs:2395:21:
index out of bounds: the len is 2 but the index is 2
stack backtrace:
   0:     0x55d79f8a1c4c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7204adf1c6fdef2b
   1:     0x55d79f5edf2f - core::fmt::write::h3d00f283bc304fde
   2:     0x55d79f8928db - std::io::Write::write_fmt::h5db6a9a78fd129c0
   3:     0x55d79f8aab7b - std::panicking::default_hook::hf366cc83e545a716
   4:     0x55d79f86a9ea - fish::panic::panic_handler::{{closure}}::he5fb06e1dd5a90b6
   5:     0x55d79f8aae31 - std::panicking::panic_with_hook::h9ea074a53b4fce1f
   6:     0x55d79f8a2138 - std::panicking::panic_handler::{{closure}}::hf295b94ad9f5b1fe
   7:     0x55d79f8a2099 - std::sys::backtrace::__rust_end_short_backtrace::h16141967bfc5ce64
   8:     0x55d79f8a860c - __rustc[efec867641465232]::rust_begin_unwind
   9:     0x55d79f5c64df - core::panicking::panic_fmt::h481d4ab272fd0b5b
  10:     0x55d79f5c697a - core::panicking::panic_bounds_check::h02f8a9d972789da2
  11:     0x55d79f725963 - fish::reader::reader::ReaderData::delete_inner_word::he860834a48ca7a41
  12:     0x55d79f71836f - fish::reader::reader::Reader::handle_char_event::hba271cecbc1ddfe2
  13:     0x55d79f7157ee - fish::reader::reader::Reader::readline::h3328b241681951e2
  14:     0x55d79f712979 - fish::reader::reader::reader_read::hf4973bdc8e79c8c4
  15:     0x55d79f5e216f - fish::throwing_main::h0f321517dde4475d
  16:     0x55d79f86a86c - fish::panic::panic_handler::haf3bd8ded1574e79
  17:     0x55d79f5e6600 - fish::main::h30ad658a920422d6
  18:     0x55d79f86b586 - std::sys::backtrace::__rust_begin_short_backtrace::h4ffcd49761457a28
  19:     0x55d79f5e7163 - main
  20:     0x7f13d282b285 - __libc_start_call_main
  21:     0x7f13d282b338 - __libc_start_main_alias_2
  22:     0x55d79f5dc615 - _start
  23:                0x0 - <unknown>
fish crashed, please report a bug. Debug PID 811482 or press Enter to exit

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0