kraanzu / dooit

An awesome TUI todo manager

Home Page:https://pypi.org/project/dooit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] After writing a todo pressing esc cancels the todo

sathishmanohar opened this issue · comments

Since dooit is vim inspired. I press esc after writing a todo description which currently cancels the whole todo. I was spooked by this behavior a couple of time now.

I think this behavior should only apply to empty to-dos and if the to do has a description then pressing esc should save the todo and not cancel it.

Hmm... Actually, this was the behavior in the previous version but some people recommended against it!
There has to be some keybinding for canceling the todo so I went with this option!

Any ideas on how users should cancel the task addition/editing then?

This could work.

When a todo is empty. Esc just cancels the todo.
When a todo is not empty. Esc saves the todo.
    - After saving user can simply press xx to delete that todo
When a todo is not empty. Pressing <ctrl+l> just like shortcut for clear in terminal clears the todo 
and remains in insert mode. After that the user can either continue typing or press esc to cancel the todo.

Hmmm... Maybe I can add something to the config regarding this!

Got it. At least there could be a prompt before cancelling which can be disabled in config.

commented

I would love this enhancement. My muscle memory keeps having me press escape when I'm done editing. Sometimes I'll rewrite the same todo 3 times because I keep pressing escape when I'm done typing.
The way it is now seems a bit strange. I'll create a new todo with 'a' type my todo, then hit enter. And now I'm suddenly typing a new todo item, so I have to hit escape to get out of it.
I'd prefer if it wouldn't automatically create a new empty todo after I hit enter. I wouldn't mind having to press 'a' again to add a new entry.

But ideally, I'd hit 'a' to add a new item. Type it in, hit escape, and it's saved, without it adding another empty item after.

I would love this enhancement. My muscle memory keeps having me press escape when I'm done editing. Sometimes I'll rewrite the same todo 3 times because I keep pressing escape when I'm done typing. The way it is now seems a bit strange. I'll create a new todo with 'a' type my todo, then hit enter. And now I'm suddenly typing a new todo item, so I have to hit escape to get out of it. I'd prefer if it wouldn't automatically create a new empty todo after I hit enter. I wouldn't mind having to press 'a' again to add a new entry.

But ideally, I'd hit 'a' to add a new item. Type it in, hit escape, and it's saved, without it adding another empty item after.

agree, the new todo item once I finished typing bugs me too. How about using Ctrl+Enter as finishing typing current item and start a new item while using Enter as only finishing current item?

commented

Since dooit is vim inspired. I press esc after writing a todo description which currently cancels the whole todo. I was spooked by this behavior a couple of time now.

I think this behavior should only apply to empty to-dos and if the to do has a description then pressing esc should save the todo and not cancel it.

Same here!

How about using Ctrl+Enter as finishing typing current item and start a new item while using Enter as only finishing current item?

Sounds like a good idea but the in the terminal enter, shift+enter and ctrl+enter are the same
You can verify this in textual keys by writing textual keys in your terminal

I guess I'll change it to stop by pressing escape and the user can delete the item if they want to delete it?
Or maybe then can press something else to cancel it..maybe ctrl-c? :p

You may want to look into terminal shortcuts. These will make the editing more consistent across terminals.

Ctrl+u to delete from cursor to beginning of the line
Ctrl+k to delete from cursor to end of the line
Ctrl+a to go to the start of the line
Ctrl+e to go to the end of the line
Ctrl+c to go to cancel the ongoing todo
Esc saves like in vim