Skip to content

Commit 5c42c49

Browse files
vinsworldcomVinsWorldcom
andauthored
Add ESC key in console sets focus to current Scintilla editor buffer (#291)
Fix #290 Co-authored-by: VinsWorldcom <[email protected]>
1 parent 869f5c3 commit 5c42c49

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

PythonScript/src/ConsoleDialog.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ INT_PTR CALLBACK ConsoleDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
208208
//MessageBox(NULL, _T("Command") , _T("Python Command"), 0);
209209
return FALSE;
210210
}
211+
else if (LOWORD(wParam) == IDCANCEL)
212+
{
213+
::SetFocus(getCurrScintilla());
214+
return FALSE;
215+
}
211216
break;
212217

213218
case WM_SETFOCUS:

PythonScript/src/PythonScript.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,3 +718,10 @@ static void previousScript()
718718
runScript(g_previousScript.c_str(), false);
719719
previousScript_clicked = false;
720720
}
721+
722+
HWND getCurrScintilla()
723+
{
724+
int which = -1;
725+
::SendMessage( nppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, ( LPARAM )&which );
726+
return ( which == 0 ) ? nppData._scintillaMainHandle : nppData._scintillaSecondHandle;
727+
}

PythonScript/src/PythonScript.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010
// The first scintilla notification - this is 2000
1111
#define SCN_FIRST_NOTIFICATION SCN_STYLENEEDED
1212

13+
#include <windows.h>
14+
15+
HWND getCurrScintilla();
16+
1317
#endif

0 commit comments

Comments
 (0)