matchai / spacefish

🚀🐟 The fish shell prompt for astronauts
https://spacefish.matchai.dev
MIT License
963 stars 77 forks source link

Tab completion deletes prompt character #179

Closed pikeas closed 5 years ago

pikeas commented 5 years ago

Bug Report

Current Behavior When pressing <tab> to trigger shell completion, the character under the cursor (whether part of the prompt or typed by the user) is deleted.

Here are before/after images to demonstrate:

Screenshot 2019-04-01 16 27 57 Screenshot 2019-04-01 16 28 14

Pressing <tab> again does not delete additional characters.

So far, this only seems to happen when the package section is present.

Expected Behavior The character under the cursor should not be deleted.

Relevant Fish Configuration

# I am using the default Spacefish fish_prompt.fish

# config.fish
set -g SPACEFISH_CHAR_SYMBOL "❯"
set -g SPACEFISH_PROMPT_DEFAULT_SUFFIX " "
set -g SPACEFISH_PROMPT_SUFFIXES_SHOW true
set -g SPACEFISH_PROMPT_ORDER package

Environment

matchai commented 5 years ago

Hey @pikeas! Thank you for opening an issue. 😄

Unfortunately I'm having no luck reproducing the issue as described. Would you be able to provide a screen recording using asciicinema of the issue occurring so we can get a better idea of what is happening?

pikeas commented 5 years ago

@matchai Thanks for the quick reply! Here's a recording: https://asciinema.org/a/PGuwaFqRyQ2OzmuIQCDZtn99B

Please let me know if you'd like any additional information about my environment. After the above video, I removed package from my prompt, sourced my config file, and the bug was gone.

matchai commented 5 years ago

@pikeas does the issue occur when using a multi-line prompt? (e.g. having line-sep in SPACEFISH_PROMPT_ORDER) I'm thinking it may be an issue with the character width of the emoji on the same line as the prompt which may be causing the issue.

If the issue doesn't occur when the prompt is on the next line, make sure you're using iTerm2 v3 and in Preferences > Profiles > Text, use the following settings:

image

Then, add the following to your fish config:

# Set the emoji character width
set -g fish_emoji_width 2
pikeas commented 5 years ago

That did the trick! I already had Use Unicode version 9 widths enabled, but did not have fish_emoji_width set. Thanks!

matchai commented 5 years ago

No problem. Glad that solved it! 😄