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

graceful exit from "e" #30

Open
smichr opened this issue Sep 29, 2024 · 1 comment
Open

graceful exit from "e" #30

smichr opened this issue Sep 29, 2024 · 1 comment

Comments

@smichr
Copy link

smichr commented Sep 29, 2024

The command "e" prompts for a file name. If this was an accident (like trying to use "e" for "edit" like "i" for "insert") then it would be nice to have a graceful way to cancel the command and continue editing.

@matthewdeanmartin
Copy link
Owner

Okay, here is what is going on:

  • input() doesn't allow for a default value, so input(" > ") will give you a prompt, but you can prefill it with the text to be edited.
  • Win32 API code sends keys to input to add the value.
  • Error handling is wonky and complains 'can't re-enter readline' when the hook into control-c runs.
  • I updated it to just ignore the control C. This doesn't visually undo the edit, but the edit didn't happen.
  • The user is stuck in edit mode.

I think I need to unregister the hook that captures control-c for exiting the program when line editing is happening.

I published the hack for the moment.

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

No branches or pull requests

2 participants