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

CTRL+U incorrect behaviour #115

Open
Bilge opened this issue Nov 16, 2015 · 4 comments
Open

CTRL+U incorrect behaviour #115

Bilge opened this issue Nov 16, 2015 · 4 comments

Comments

@Bilge
Copy link

Bilge commented Nov 16, 2015

CTRL+U is supposed to remove characters before the cursor. Instead, it removes all characters. NB: CTRL+K works correctly by only deleting characters after the cursor.

@sserbin
Copy link
Contributor

sserbin commented Dec 15, 2015

CTRL+U is supposed to remove characters before the cursor. Instead, it removes all characters

That's not entirely correct - this is an expected default behavior in readline only and you're probably using libedit (you can check readline_info() output to make sure).

In libedit, by default, Ctrl-U deletes entire line (as long as you're in emacs mode). Ctrl-W deletes all before cursor in libedit (in readline, Ctrl-W removes a word before cursor). You can also re-map Ctrl-U to delete everything before the cursor by adding the following to your ~/.editrc : bind "^U" vi-kill-line-prev

@Bilge
Copy link
Author

Bilge commented Dec 15, 2015

you're probably using libedit

Actually I was referring to bash conventions but thanks for the information. It's too bad boris can't use bash.

@sserbin
Copy link
Contributor

sserbin commented Dec 16, 2015

The thing is bash itself does not provide any of the line-editing/history capabilities. Instead, it leverages a library which manages all of that - readline. The conventions (keyboard shortcuts) you're referring to - are actually readline conventions.

Due to the fact readline is GPL-licensed, a number of alternative interface-compatible libraries have been developed for those wishing to remain under less permissive license (with libedit (BSD licensed) being the most widespread I believe). Others just choose to implement their own line-editing libraries (like Haskelline in Haskell or ZLE in ZSH).

Back to php and boris - boris relies on php's readline extension capabilities which in turn can be compiled with either readline or libedit libraries support. I believe in Debian-derivatives you'd mostly find php-readline package to be linked to libedit (as opposed to RHEL and CentOS - they link php5-readline to libreadline) - this is what I meant by "you're probably using libedit".

All in all, boris doesn't have any control on the underlying line-editing implementation (and thus default keyboard shortcuts) - it all depends on the environment.

@Bilge
Copy link
Author

Bilge commented Dec 16, 2015

Thanks for the detailed explanation @sserbin, I didn't realize the behavior was platform-dependent. Your suggestion to modify ~/.editrc worked for me so thanks a lot for that.

Since you appear so knowledgeable on this topic, do you have a way to fix my one other outstanding complaint about the [delete] key not working as expected? (#116)

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

No branches or pull requests

2 participants