Pistos / diakonos

Diakonos is a console text editor for the masses.
https://git.sr.ht/~pistos/diakonos
Other
137 stars 11 forks source link

feature: shift-select #23

Closed grandinj closed 10 years ago

grandinj commented 12 years ago

Awesome editor!

It would be great if it supported shift-selection i.e. selecting text by holding down the SHIFT key and then using the cursor keys.

Thanks.,

Pistos commented 12 years ago

Thanks for the compliment.

Unfortunately, shift-arrow is often captured by the terminal window. It is also indistinguishable from normal arrow keys (without shift) in the TTY terminals. This is one of the first things I tried to do in early Diakonos development, though.

Thanks for your feedback.

grandinj commented 12 years ago

If I load the map specified here: http://oss.sgi.com/LDP/HOWTO/Config-HOWTO/x43.html

Will diakonos recognise the command sequences?

Pistos commented 12 years ago

It might, but in order to use shift-arrow for selection, the selection feature would have to be changed accordingly. That's non-trivial.

dominikh commented 12 years ago

shift+arrows actually is very distinguishable in terminals, at least in the ones I tested (rxvt, screen, xterm).

Pistos commented 12 years ago

While that may be true, I wouldn't want to get degrade or confuse my muscle memory as to which keys to press for selection. :) More importantly, anyway, there needs to be new code for handling starting and stopping selection with such keystrokes.

grandinj commented 12 years ago

I would really like this feature - every other editor I use supports it. Would you object to a patch to implement it, and if so, where in the code should I start looking? Thanks.

Pistos commented 12 years ago

@grandinj : I would not object to a cleanly-written pull request for this feature. This is a core function of the editor, though, so it has to be written with care. It should be a configuration setting, too, to choose between the classic selection method and this new one.

Begin by writing new tests in spec/functions/selection.rb. Then add new key-assignable functions in lib/diakonos/functions/selection.rb and modify lib/diakonos/buffer/selection.rb to do the bulk of the work.

Pistos commented 10 years ago

Those of you interested in this alternative selection method: Please try the shift-select branch. Ensure your system/installation config is updated with the one from this branch, as it contains key definitions that are necessary for the new feature to work.

Pistos commented 10 years ago

Oops, there's a bug when you try to shift-select and scroll down past the page edge.

Pistos commented 10 years ago

Fixed.

Pistos commented 10 years ago

This is now in the master branch, and will be present in the release of version 0.9.2.