I think this article should help you: http://msdn.microsoft.com/en-us/library/windows/desktop/ee416808(v=vs.85).aspx
If you look at the second example, you will see that it basically gives you what you want. You may put the code that's going to be below (Aside from the WinMain method) in a separate file and have your program call it.
STICKYKEYS g_StartupStickyKeys = {sizeof(STICKYKEYS), 0};
TOGGLEKEYS g_StartupToggleKeys = {sizeof(TOGGLEKEYS), 0};
FILTERKEYS g_StartupFilterKeys = {sizeof(FILTERKEYS), 0};
INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
{
// Save the current sticky/toggle/filter key settings so they can be restored them later
SystemParametersInfo(SPI_GETSTICKYKEYS, sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
SystemParametersInfo(SPI_GETTOGGLEKEYS, sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
SystemParametersInfo(SPI_GETFILTERKEYS, sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
// Disable when full screen
AllowAccessibilityShortcutKeys( false );
// Restore back when going to windowed or shutting down
AllowAccessibilityShortcutKeys( true );
}
void AllowAccessibilityShortcutKeys( bool bAllowKeys )
{
if( bAllowKeys )
{
// Restore StickyKeys/etc to original state and enable Windows key
STICKYKEYS sk = g_StartupStickyKeys;
TOGGLEKEYS tk = g_StartupToggleKeys;
FILTERKEYS fk = g_StartupFilterKeys;
SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
SystemParametersInfo(SPI_SETTOGGLEKEYS, sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
}
else
{
// Disable StickyKeys/etc shortcuts but if the accessibility feature is on,
// then leave the settings alone as its probably being usefully used
STICKYKEYS skOff = g_StartupStickyKeys;
if( (skOff.dwFlags & SKF_STICKYKEYSON) == 0 )
{
// Disable the hotkey and the confirmation
skOff.dwFlags &= ~SKF_HOTKEYACTIVE;
skOff.dwFlags &= ~SKF_CONFIRMHOTKEY;
SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &skOff, 0);
}
TOGGLEKEYS tkOff = g_StartupToggleKeys;
if( (tkOff.dwFlags & TKF_TOGGLEKEYSON) == 0 )
{
// Disable the hotkey and the confirmation
tkOff.dwFlags &= ~TKF_HOTKEYACTIVE;
tkOff.dwFlags &= ~TKF_CONFIRMHOTKEY;
SystemParametersInfo(SPI_SETTOGGLEKEYS, sizeof(TOGGLEKEYS), &tkOff, 0);
}
FILTERKEYS fkOff = g_StartupFilterKeys;
if( (fkOff.dwFlags & FKF_FILTERKEYSON) == 0 )
{
// Disable the hotkey and the confirmation
fkOff.dwFlags &= ~FKF_HOTKEYACTIVE;
fkOff.dwFlags &= ~FKF_CONFIRMHOTKEY;
SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &fkOff, 0);
}
}
}
Hopefully this helps.
This undesired behavior is hard-coded into Scintilla, the text editing component that underlies Notepad++. It can be fixed by removing the following three lines from src/ScintillaBase.cxx
:
case SCI_NEWLINE:
AutoCompleteCompleted(0, SC_AC_NEWLINE);
return 0;
With this change, the Enter key no longer commits autocompletion. The Tab key already does that, as noted by user2427906.
It should be possible to download the source code for Notepad++ (which includes Scintilla), make the above change in scintilla\src\ScintillaBase.cxx
(the code is slightly different in Notepad++ 6.9, but this shouldn’t be a problem), and then build Notepad++ from the modified source code.
I haven’t tried this because I don’t use Notepad++ nor Windows, but I did the same to Geany—another text editor based on Scintilla—and it seems to work.
Best Answer
In Settings -> Shortcut mapper -> Scintilla commands
Double click
SCI_NEWLINE
(should be item 9 in the list), selectEnter
and remove it.------ EDIT -------
Note that you can't add
Enter
back after removing it in Notepad++. One way to add it back is open%appdata%\Notepad++\shortcuts.xml
file, and change following lines:to following:
save file and restarte NotePad++, and the setting should be restored.