Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying from end of buffer crashes on Fish 3.1.0 #6680

Closed
okamsn opened this issue Feb 28, 2020 · 2 comments
Closed

Copying from end of buffer crashes on Fish 3.1.0 #6680

okamsn opened this issue Feb 28, 2020 · 2 comments
Milestone

Comments

@okamsn
Copy link

okamsn commented Feb 28, 2020

Hello,

Copying from the end of the buffer (after the last inserted character, the position reached by M->) causes Fish 3.1.0 to crash.

This is on Xubuntu 20.04.

  • Output of uname -a:

    Linux lptp2 5.3.0-40-generic history function needs a man page #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Output of echo $TERM:

    xterm-256color

There are no third party customizations. That command did not affect the crash.

The crash:
fish: /build/fish-Wz1fgo/fish-3.1.0/src/parse_util.cpp:246: void parse_util_cmdsubst_extent(const wchar_t*, size_t, const wchar_t**, const wchar_t**): Assertion `cursor_pos <= bufflen' failed.

The bindings I am trying:

bind -k nul begin-selection
bind \ew kill-selection end-selection yank

After using this command by selecting from the end of the buffer, immediately pressing a letter will insert the letter on the screen and print the crash message right after the letter.

  • The cursor jumps back to the end of the buffer.
  • I can't move the cursor with the arrow keys or C-f and C-b, but M-< and M-> work. C-p and C-n don't work either.
  • The copying will work. Pasting will insert the text, but it will not get syntax highlighting.
  • Pressing backspace will move the cursor back through the pasted text without removing from the screen.
    • Once I "backspace" all the way though the pasted text back into the pre-paste text, there are no more errors, and it won't crash.

Shortest steps to reproduce:

  1. Bind the keys.
  2. Press C-p to go back to previous command. Now at end of buffer.
  3. Press C-SPC to being selection. Move cursor towards beginning of line.
  4. Press M-w to copy. Cursor jumps back to end of buffer.
  5. Press C-y to insert the copied text. Pasted text is shown on screen without syntax coloring. Cursor is still at end of buffer.
  6. Press a to insert a at end of line. "a" inserted without color. Fish crashes with above message.
    • If instead jump to beginning of line with M-< and then press a, "a" is inserted with the correct error color, and then Fish crashes.
@okamsn okamsn changed the title Trying to copy from end of buffer crashes on Fish 3.1.0 Copying from end of buffer crashes on Fish 3.1.0 Feb 28, 2020
@okamsn
Copy link
Author

okamsn commented Feb 28, 2020

I have created this Asciinema recording showing the above steps.

https://asciinema.org/a/q7UzVZYk43cUca3aShvnS24GM

krobelus added a commit to krobelus/fish-shell that referenced this issue Feb 29, 2020
Which happened when starting the selection at the end of the commandline.
In this case, selections still interact weirdly with autosuggestions (the
first character of the suggestion appears to be part of the selection
when it's not).

Fixes fish-shell#6680

(cherry-picked from commit 99851c0)
@krobelus krobelus added this to the fish 3.1.1 milestone Feb 29, 2020
@krobelus
Copy link
Member

Thanks for the report, fixed and cherry picked to 3.1.1.
I wonder if those keybindings should be the default, but M-w is taken.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants