Notepad++ has randomly closed on me a handful of times where I explicitly know none of my fingers were on the F4 key (for Alt+F4) yet the window completely closed out. I do not have any special utilities running nor have I changed any settings in Notepad++ (if any exist) for closing the window.
-
3Are you sure it was a clean close? The alternative is you triggered a completely unrelated function, that made the program crash.– Jochen LutzCommented yesterday
-
1@JochenLutz This seems like the obvious answer. I think OP's wording got everyone focused on keyboard shortcuts.– succulent_headcrabCommented 21 hours ago
-
3@John Do you lose changes to your files when this happens? Forgetting about your fingers for a moment, is there any common factor between these random closings? Were you usually doing a similar operation or choosing a specific menu item? This sounds exactly like the program crashing and not like you accidentally closing it. Even pressing ALT+F4 or any other keyboard shortcut will still prompt you to save changes.– succulent_headcrabCommented 21 hours ago
3 Answers
It will not close the Notepad++ program, but CTRL+W will close the current file (tab); CTRL+Shift+W will close all open files.
You can bring back closed files in order with CTRL+Shift+T
-
Yeah, Ctrl+Shift+W seems a good bet, since using Ctrl+W for closing a single file is the kind of thing a user would do quite often. Commented 15 hours ago
The Alt key activates the menu. If afterwards you hit F and then X, Notepad++ will do “File -> Exit.”
This can happen in several Windows programs, depending on the menu structure. Usually in the menus, the underlined character indicates the letter(s) to hit after pressing the Alt key, in order to activate the corresponding menu item.
How to mitigate
Option 1: To completely deactivate the behaviour, you'll need to remap the Alt
key using Autohotkey. You might also need to remap Alt+f
in case you sometimes confuse the Shift
key with the Alt
key.
Option 2: I dislike remapping function keys, since that might break other things. What I would suggest is to create yourself a tactile difference on the Alt
key by sticking on some tape or glueing on a piece of paper. After a day of work, your fingers will start to tell you you're hitting the wrong key.
Option 3: Another option is to change the shortcut(s) for (a) specific menu item in the notepad++ customization files, as explained in this thread. (I'll expand this when I have some more time).
-
Wouldn't he get a dialog asking whether he wants to save the file? It seems to me that Notepad++ is crashing.– WastrelCommented 23 hours ago
-
2@Wastrel notepad++ by default will autosave a backup and close without any dialogue. It will restore the session including any edits made once it's opened up again.– 1NNCommented 18 hours ago
Another possible key combination is Alt → Space bar → C.
Pressing Alt puts the menu at the top of the window in focus, Space bar opens up the context menu for the window, and C selects Close
.