Closed ElPincheTopo closed 9 years ago
Seems reasonable in principle. In practice, I'm not sure I want to add anything that accepts Alt
. Alt
is a brand new keystroke, and would need widespread testing.
There are a number of bugs in this implementation:
y
ESC``y
on VT100-type consoles (see input.go)alty
to the action
type. A more generic implementation would add a new type alt rune
, but that would need many more changes and is overkill until we need more than just alty
.killRing
needs to be a member of commonState
)http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC6
For now, I think I will add altY as an action, just to get it working and then we can discuss how to properly add the alt to the runes.
I will make any kill operation save the killed text to the kill ring and make the killring a member of commonState.
About the whole alt thing. If you prefer, maybe we should consider changing the altY for another key so we keep avoiding using alt.
I will make any kill operation save the killed text to the kill ring and make the killring a member of commonState.
Thanks. Don't forget that consecutive kill operations append (or prepend, depending) to the same slot.
About the whole alt thing. If you prefer, maybe we should consider changing the altY for another key so we keep avoiding using alt.
If it's going to be implemented, it should use the same keys as readline. I was just pointing out that Alt is new, so we should be extra careful to test with as many terminal emulators as possible.
@peterh Done, tested in linux and windows. :smile:
Looks good. Thanks!
Small but very useful changes. Now, when you do ctrlK the part of the line that was "killed" or removed is added to a circular linked list, called the killRing. When ctrlY is pressed, the prompt enters killRing mode.
When entering killRing mode, the element pointed as current by the killRing is inserted to the line in the current position, then the system waits for one of twothings:
After the function returns, if the value for next is ctrlY then the functions starts again.