[RFC PATCH v1 0/1] Avoid accidentally overwriting macro recording
Charles Mirabile <[email protected]> Tue, 10 Feb 2026 12:21:20 -0500
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi— Long time nano user (thanks everyone for this amazing editor), first time poster (please make sure to reply to me since I am not subscribed to the list). I often accidentally hit the recording toggle instead of invoking the macro I just recorded because my fingers have sort of been trained by having to hit the start/stop keybind twice. It is very frustrating to throw away the macro I just recorded and have to spam undo and then perform the (potentially lengthy) macro again. My suggestion/idea is that if the user stops the recording immediately after starting it such that the recorded macro would be empty, instead of storing the empty macro which is essentially useless, just cancel the recording and revert the stored macro to whatever the user had saved before. Attached is a patch which accomplishes this. I tried to find a better approach than keeping both buffers around (i.e. just save/restore the buffer length, but this failed because the beginning of the buffer is clobbered by the keystrokes from the burst for the recording keybind), but I think as written it isn't too bad, though keeping the lifetimes straight to avoid a leak is a bit hairy, so I am definitely open to suggestions. If not this patch, I hope at least the idea of cancelling empty recordings instead of saving them is at least acceptable as a feature request. Best—Charlie Charles Mirabile (1): macro: Cancel recording if nothing was entered src/winio.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) -- 2.51.0