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

Dont erase the line at the end of PS1 #11

Merged
merged 1 commit into from
Jun 24, 2018

Conversation

rockandska
Copy link
Contributor

@rockandska rockandska commented May 26, 2018

Erasing the line with escape sequence K seems to prevent the reverse history to works correctly.
When we do a reverse history search with ctrl+r inside a shell and press "escape" to undo, the line is erase instead of the normal behavior who let the user edit the command found.

This PR correct this and I don't see weird side effect until now.

Normal:

(reverse-i-search)`sour': source /tmp/pureline/pureline /tmp/pureline/config.conf    ----> press escape
 $  /tmp/pureline  source /tmp/pureline/pureline /tmp/pureline/config.conf 

Actual behavior:

(reverse-i-search)`sour': source /tmp/pureline/pureline /tmp/pureline/config.conf    ----> press escape
 $  /tmp/pureline 

@chris-marsh chris-marsh merged commit 0cd3492 into chris-marsh:master Jun 24, 2018
@chris-marsh
Copy link
Owner

I have included this change due to the issues you found with the history. However, not clearing at the end of the PS1 does cause issues with the background color bleeding beyond where it should as noted here;

https://www.reddit.com/r/linux/comments/7ojwo9/pureline_a_pure_bash_powerline_prompt_simple_but/dsbe4x5/?context=3&utm_content=context&utm_medium=message&utm_source=reddit&utm_name=frontpage

@chris-marsh
Copy link
Owner

I've tested this further and I do not think the \K is causing the issues you are seeing.
Reinstating the \K, I do not experience any issues with the bash history kfce4-terminal or konsole, escape correctly leaves me with the selected command to edit.

Can you confirm you experience this issue with a clean git pull and default config?
(ps If trying a clean pull from the repo you will need to add the \K sequence back to test)

@rockandska
Copy link
Contributor Author

Hummm , seem i can't reproduce right now the behavior i had with a clean env and need to investigate further to see what caused this comportment.
Maybe a module not loaded by default ?

I will try to reproduce it and will update this PR if i found something

Sorry about that :/

$ env -i bash --noprofile --norc --login
bash-4.3$ git clone https://github.com/chris-marsh/pureline /tmp/pureline
Cloning into '/tmp/pureline'...
remote: Counting objects: 365, done.        
remote: Compressing objects: 100% (21/21), done.        
remote: Total 365 (delta 12), reused 12 (delta 5), pack-reused 339        
Receiving objects: 100% (365/365), 922.56 KiB | 540.00 KiB/s, done.
Resolving deltas: 100% (211/211), done.
Checking connectivity... done.
bash-4.3$ cd /tmp/pureline/                                              
bash-4.3$ pwd
/tmp/pureline
bash-4.3$ git checkout 1e44b57a67e9a5ab1c81cfffd8e0d2c359eda807          
Note: checking out '1e44b57a67e9a5ab1c81cfffd8e0d2c359eda807'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 1e44b57... Updated readme and example config with new git modules
bash-4.3$ source ~/pureline/pureline
(reverse-i-search)`clone': git clone https://github.com/chris-marsh/pureline   ---> press escape
 laptop  /tmp/pureline  git clone https://github.com/chris-marsh/pureline

@rockandska
Copy link
Contributor Author

Reproducible when you at least add the newline module (in some use case, the history command line are mixed with itself)
asciicast

Don't have this behavior with the commit of this PR:
asciicast

Commands done before "asciinema rec" were :

$ exec env -i bash --noprofile --norc
bash-4.3$ export SHELL="/bin/bash --norc --noprofile --login"                
bash-4.3$ export TERM=xterm                                                  
bash-4.3$ export LANG=en_GB.utf8
bash-4.3$ export HOME=/home/yoann

@chris-marsh
Copy link
Owner

chris-marsh commented Sep 18, 2018

A new option has been added to make erasing to end of line optional. You can now set;
PL_ERASE_TO_EOL=false
in the config file.

OHermesJunior pushed a commit to OHermesJunior/pureline that referenced this pull request Jun 30, 2019
Dont erase the line at the end of PS1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants