garybernhardt / selecta

A fuzzy text selector for files and anything else you need to select. Use it from vim, from the command line, or anywhere you can run a shell command.
MIT License
1.34k stars 81 forks source link

Selecta could/should allow use of up/down arrows #81

Closed purpleidea closed 9 years ago

purpleidea commented 9 years ago

Not sure if this is entirely within scope, but I think it would be quite natural:

When running selecta, allow up/down key presses to navigate up/down the list of displayed items. Useful to pop "down" one or two, and press enter to select.

HTH

rschmitt commented 9 years ago

https://github.com/garybernhardt/selecta/issues/76 https://github.com/garybernhardt/selecta/issues/71 https://github.com/garybernhardt/selecta/issues/15

purpleidea commented 9 years ago

@rschmitt woops. Sorry for the noise... So after reading a bit... Is this supposed to work now or not?

rschmitt commented 9 years ago

No. I believe it was supported for a brief period, but that support was dropped due to inconsistent behavior on different platforms (sometimes it worked, sometimes it didn't). Ctrl-N and Ctrl-P have always worked, however. There is an open issue on a Selecta clone (https://github.com/felipesere/icepick/issues/27) that has proposed the tab key as an alternative to the down arrow.

purpleidea commented 9 years ago

@rschmitt Then this issue is valid :) The arrow key processing requires that you way a small delay to see if other chars come in. I haven't implemented this recently, but I can dig up some old python code if needed. If OSX is doing something dumb, then we should ignore that, or just switch based on $TERM or similar...

rschmitt commented 9 years ago

Are you also aware of the cursor mode issues discussed in https://github.com/garybernhardt/selecta/issues/76#issuecomment-72748802?

purpleidea commented 9 years ago

@rschmitt I did see this yes. Sounds like there's a bug in here or rather in some lib somewhere... I don't have a patch to offer (sorry) but +1 to whoever fixes this :)

garybernhardt commented 9 years ago

The bug is in the design of the VT100 protocol. ;) ESC means multiple things and the only way to distinguish between them is by waiting and guessing. Selecta does VT100 for output, but not for input, because I don't want to (1) maintain code for input escape codes, or (2) depend on a giant library from the 80s. Fortunately, ^P and ^N work everywhere in Unix (even in Vim!), so switching to them is a good idea anyway.