taskell icon indicating copy to clipboard operation
taskell copied to clipboard

Add Support for ctrl+h

Open AtomToast opened this issue 5 years ago • 10 comments

Ctrl+h is a convenient shortcut inside of the terminal so you don't have to reach for the backspace key. I use it everywhere, however taskell does not appear to support it.

It sends the ^H signal (0x08) instead of the ^? (0x7f) many terminals use for backspace nowadays

AtomToast avatar Sep 21 '20 13:09 AtomToast

Hadn't come across that. Sounds useful.

Supporting modifier keys is a bit tricky. Apparently the signals are not terribly consistent between terminal emulators. I don't actually have much control over it as it relies on the library I'm using. I've not had much success when I've tried previously.

I'll give it another go at some point – it's possible that a more recent version of the code makes it easier. I'd certainly like to be able to support modifier keys.

smallhadroncollider avatar Oct 07 '20 08:10 smallhadroncollider

I don't even know if supporting modifiers would be necessary. It could potentially work by just supporting the different keycode in the terminal. ^H is typically the delete keycode (not the one sent by the delete key which is different). I don't know the exact historical reasoning but typically in modern terminals it is also sent with a modifier + backspace.

What is the library you're using? No modifiers seems like a weird oversight

AtomToast avatar Oct 07 '20 09:10 AtomToast

Brick

It's not that it doesn't support modifiers, just that they're not very reliable. I think I remember reading that this is to do with inconsistencies between terminal emulators (although it was a few years ago).

smallhadroncollider avatar Oct 07 '20 11:10 smallhadroncollider

Hmm, just tried ctrl+h in Taskell and it worked without me having to do anything.

smallhadroncollider avatar Oct 07 '20 11:10 smallhadroncollider

What terminal are you using? I tried it in st, alacritty and termite.

Can you also maybe check the output of showkey -a?

AtomToast avatar Oct 07 '20 11:10 AtomToast

I looked a bit through your and the brick source code and both in your code and the brick source code you seem to be using the EvKey KBS which is defined here

However, this is about as far as I can get with my knowledge of haskell. I don't know where I could look at the implementation of this. Basically the reason why I am looking here is in case the issue might be higher up stream. Though I don't know any other projects that use this or the inbuilt editor thingy from brick to check if it's a general issue.

Though this actually made me consider that potentially we should turn this issue into one about general support for shell/readline bindings? All those handy bindings (or at least the most important ones) like ctrl+w, ctrl+u, ctrl+a, ctrl+e etc. I actually keep hitting ctrl+a already to try and jump to the beginning of the text input in order to add something to the beginning of a Task.

AtomToast avatar Oct 07 '20 20:10 AtomToast

I was using Terminal on macOS. showkey doesn't seem to be a thing on macOS.

As I say, Brick supports modifier keys, they're just not consistent between platforms, so it's not very useful.

smallhadroncollider avatar Oct 08 '20 12:10 smallhadroncollider

Hm, weird. Is there another way to check keycodes on mac os?

AtomToast avatar Oct 09 '20 11:10 AtomToast

Hm, weird. Is there another way to check keycodes on mac os?

Maybe this can help?

May I hijack this conversation to also request support for the suspend signal (Ctrl-Z)? Or should I open a ticket?

PS. Began using Taskell today, great app @smallhadroncollider 👏🏻 👏🏻 👏🏻

bjacquet avatar Apr 13 '21 13:04 bjacquet

@bjacquet A separate ticket please 😃

smallhadroncollider avatar Apr 20 '21 09:04 smallhadroncollider