Feature Request - PgUp/PgDn Key Support #207

Open
opened 2021-03-17 14:50:09 +00:00 by demure · 1 comment

Can some default bindings be added for PgUp/PgDn keys?
I find these keys indispensible when using cli programs, and it would be nice if bombadillo used them as well.

Can some default bindings be added for PgUp/PgDn keys? I find these keys indispensible when using cli programs, and it would be nice if bombadillo used them as well.
Owner

Sadly, Golang does not provide any form of get key functionality and Bombadillo has a strict policy of not using third party libraries. As a result we have rolled our own get key functionality. Due in part to being a vi keybinding oriented client we did not add parsing for multibyte keys (ctrl+key, arrows, pgup/down, etc). I wont say never, but I do not see this changing any time soon.

You can access page up and down functionality with u and d in the interim. Those could easily be mapped to other single byte keys really easily in client.go's main input loop if you would like a different single byte binding.

I have resisted remappable keys for Bombadillo, but maybe it is time to consider that as something to offer (though it would still only offer single byte keys). My development time is slim (I have a 2 year old), but I will add remapping to my eventual to do list.

I would definitely be open to a pull request with multibyte input parsing for getKey (that does not involve a third party lib). If you were interested in taking a shot at it the relevant code would be in the cui folder and the termios folder. The termios would need to be set with a short timeout on keypress and the cui code for get key would need to read multiple and be able to accept null read. I know it can be done in go, but I'm not sure how to do it (I could do it in C, but don't want to drop to cgo).

Sorry for the longwinded answer, but I did want to fully consider the request and respond with my thoughts on it.

Sadly, Golang does not provide any form of get key functionality and Bombadillo has a strict policy of not using third party libraries. As a result we have rolled our own get key functionality. Due in part to being a vi keybinding oriented client we did not add parsing for multibyte keys (ctrl+key, arrows, pgup/down, etc). I wont say never, but I do not see this changing any time soon. You can access page up and down functionality with `u` and `d` in the interim. Those could easily be mapped to other single byte keys really easily in `client.go`'s main input loop if you would like a different single byte binding. I have resisted remappable keys for Bombadillo, but maybe it is time to consider that as something to offer (though it would still only offer single byte keys). My development time is slim (I have a 2 year old), but I will add remapping to my eventual to do list. I would definitely be open to a pull request with multibyte input parsing for getKey (that does not involve a third party lib). If you were interested in taking a shot at it the relevant code would be in the `cui` folder and the `termios` folder. The termios would need to be set with a short timeout on keypress and the cui code for get key would need to read multiple and be able to accept null read. I know it can be done in go, but I'm not sure how to do it (I could do it in C, but don't want to drop to cgo). Sorry for the longwinded answer, but I did want to fully consider the request and respond with my thoughts on it.
sloum added the
enhancement
label 2021-03-17 15:12:05 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#207
No description provided.