Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to todo item editing #36

Closed
andrei-a-papou opened this issue Feb 11, 2024 · 10 comments
Closed

Improvements to todo item editing #36

andrei-a-papou opened this issue Feb 11, 2024 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@andrei-a-papou
Copy link

I'd like to propose the following improvements to editing a todo:

  1. By way of analogy to the del-to-bol command, add a del-to-eol command. It could have a default binding of ^K -- a-la Emacs/Midnight Commander.
  2. Would it be possible to implement Ctrl + arrow keys navigation? A user holds down Ctrl and then the left/right arrow keys move a whole word at a time. When editing a longer todo, this allows moving around much more efficiently :)
  3. In the same way, would it be possible to add del-word-right and del-word-left (perhaps bound to Ctrl + Delete and Ctrl + Backspace by default) to delete one word at a time?
@vonshednob
Copy link
Owner

Perfect requests! Yes, these are possible to implement, but I was too lazy and was hoping for someone to come around and complain 😀

@vonshednob vonshednob added the enhancement New feature or request label Feb 12, 2024
@vonshednob vonshednob self-assigned this Feb 14, 2024
@andrei-a-papou
Copy link
Author

andrei-a-papou commented Feb 14, 2024

Being able to use Ctrl-based bindings when editing todos is very important to me since I'm currently grooming a large todo file. So I made a patch myself :) The code is probably ugly in places if only because I know next to nothing about curses. So I'll most certainly appreciate it if you could take a look.

Things seem to be working fine after a half day of usage, but give me a couple days to test it more thoroughly in the trenches and I'll post the patches, is that OK?

@vonshednob
Copy link
Owner

By all means! Forking and patching is what open source is good for, after all 😁

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Feb 18, 2024

I've tested my patches for a couple of days, and they seem to be stable. So here you go:

80-ctrl-key-functions-1.diff.gz
80-ctrl-key-functions-2.diff.gz
90-ctrl-key-combos.diff.gz

I'm not 100% sure the detection of Ctrl-based combinations will work on every machine (I detect values of 524, 550 and 565), so I'd be curious about your experience. Key combos in curses-based apps can be tricky due to various terminals and environments used.

Also, I've redefined ^H to work as Ctrl + Backspace rather than plain Backspace. This is a bit non-standard: e.g. bash doesn't do it, but then again bash has Alt/Meta + Backspace which we can't have in pter yet. I reasoned the user can always map <ctrl_backspace> to del-left to make both ^H and ^? act as Backspace.

@vonshednob
Copy link
Owner

Yeah, the keymap compatibility due to the various terminals has caused other issues, too. I have the nagging feeling that these types of issues will accumulate to a degree that might require a change of the backend… well, that’s for the future.

I’ll merge your changes with the next release! Thanks a lot!

@vonshednob
Copy link
Owner

Aaaand merged! Soon I'm through all pending issues and then I'll release.

I might add the configuration option word-boundary-characters or word-delimiters or something.

@andrei-a-papou
Copy link
Author

Aaaand merged! Soon I'm through all pending issues and then I'll release.

Can't wait! :)

I might add the configuration option word-boundary-characters or word-delimiters or something.

Yes!

P. S. Is this a good time to also take a look at #52 and possibly merge it?

@vonshednob
Copy link
Owner

Absolutely! I intend to get all the open issues into the next release.

@andrei-a-papou
Copy link
Author

Alright, but releasing might take a while if I keep sending you patches :) I'll stop for now :)

@vonshednob
Copy link
Owner

So here we go -- until the end of this weekend I'll still assign new issues to the version 3.16 milestone but every subsequent new issue will have to wait longer. This'll do the trick to get a release out, I'm sure 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants