matchai/spacefish

Tab completion deletes prompt character

pikeas opened this issue · 5 comments

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

  • Spacefish version: 2.4.0
  • Fish version: 3.02
  • Fish plugin manager:
  • Terminal emulator: iTerm
  • Operating system: OSX 10.14.2

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?

@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.

@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

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

No problem. Glad that solved it! 😄