liquidprompt icon indicating copy to clipboard operation
liquidprompt copied to clipboard

Line oddities when using vi-style editing and search (/) while in a git repo

Open guice opened this issue 8 years ago • 9 comments

Shell: bash Operating system: macOS Liquid Prompt version (tag, commit): master (pulled just today)

Seems to be related to exit code (exit code color?), in combination with git branch.

Seen it only happen when:

  • In a git repo.
  • with an exit code or with a git status update.

Replicate:

  • set -o vi
  • cd into a known git repo directory. You should see master or your branch
  • Hit cntl-c to get 1 exit code.
  • Hit escape
  • Hit / to search.

Actual:

  • When you hit / the cursor backs over the git smart prompt ('±'), never showing '/'.
  • Searching for command causes results to appear far to the right.

Expected:

  • hitting / should show within your command. Hitting enter should search right at the same location.

See screenshot of the result screen shot 2017-02-09 at 1 41 22 pm

First command is standard search. Second in is after hitting cntl-c to cancel the previous search.

This screenshot is within a git repo with modifications screen shot 2017-02-09 at 1 50 35 pm

guice avatar Feb 09 '17 21:02 guice

Please, "master (pulled just today)" is not helpful.

dolmen avatar Feb 12 '17 22:02 dolmen

I just updated today, and this appears to have been fixed now. There was a minor update to shell script. We can close this out now.

guice avatar Feb 13 '17 19:02 guice

Okay, sorry. I need to reopen this. My fault. It appears it wasn't fixed. Current pull: fresh master @ 47126c7d - 1.11 2016-06-25 (latest date in CHANGES)

Here's how I was able to replicate this pretty quickly:

  • New Checkout && enter directory
  • ls -lrt (put in history for later test below)
  • set -o vi
  • For expected behavior before next step: hit escape followed by /; type ls hit enter; you should see your ls -lrt from above.
  • source liquidprompt
  • vim test.sh (remove a blank line) & save (adds +/- changes to prompt)
  • hit escape followed by / for search.
  • type ls - hit enter

You'll see this: screen shot 2017-02-14 at 10 18 15 am

Hitting enter again will do a standard ls

guice avatar Feb 14 '17 18:02 guice

I can reproduce this on commit 47126c7.

Rycieos avatar Feb 14 '17 18:02 Rycieos

I tested this with a git bisect, and the problem can be found all the way back to the project's initial commit. This points towards a bash problem...

#370 was a similar problem, but their causes might not be related, as that was fixed in #371.

Rycieos avatar Feb 14 '17 19:02 Rycieos

This, however, works fine in standard bash, without liquidprompt. And it works in most instances -- I've only seen it fail within git repo directory with modifications. This works if you're on master with no commits:

  • git checkout . (reset repo to fresh, no modifications)
  • escape and / type ls

Works as expected. Only happens within repo with modifications.

Combination of (?) and bash?

guice avatar Feb 14 '17 19:02 guice

You are right that it works in standard bash, but it breaks for me even in a repo without any modifications showing.

Rycieos avatar Feb 14 '17 19:02 Rycieos

In bash, editing is handled by the readline library.

There are also formatting issue in emacs mode when typing ^R (search backwards).

dolmen avatar Feb 23 '17 21:02 dolmen

I can no longer reproduce this. My setup hasn't changed all that much, but I can no longer reproduce no mater what I try. I also checked out 47126c7d973ee27fec0ee38296d70fa8bc9b1ab1 which is what I earlier said I could reproduce on, and I no longer can. So obviously there is some sort of environment issue causing this.

Can you try the latest version, v1.12-rc.1, and see what happens? If you are still affected, can you dump as much information about your environment as you can? OS version, shell version, terminal emulator version, stuff like that. And obviously try to minimize your configuration.

Rycieos avatar Jul 07 '20 15:07 Rycieos