liquidprompt
liquidprompt copied to clipboard
Line oddities when using vi-style editing and search (/) while in a git repo
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
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
Please, "master (pulled just today)" is not helpful.
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.
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/
; typels
hitenter
; you should see yourls -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:
Hitting enter again will do a standard ls
I can reproduce this on commit 47126c7.
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.
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/
typels
Works as expected. Only happens within repo with modifications.
Combination of (?) and bash
?
You are right that it works in standard bash, but it breaks for me even in a repo without any modifications showing.
In bash, editing is handled by the readline
library.
There are also formatting issue in emacs mode when typing ^R
(search backwards).
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.