@@ -68,7 +68,14 @@ BOOL ConsoleDialog::run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
6868 case WM_COMMAND:
6969 if (LOWORD (wParam) == IDC_RUN)
7070 {
71- runStatement ();
71+ if (m_runButtonIsRun)
72+ {
73+ runStatement ();
74+ }
75+ else
76+ {
77+ m_console->stopStatement ();
78+ }
7279 // MessageBox(NULL, _T("Command") , _T("Python Command"), 0);
7380 return TRUE ;
7481 }
@@ -171,8 +178,12 @@ void ConsoleDialog::historyNext()
171178
172179void ConsoleDialog::historyAdd (const char *line)
173180{
174- m_history.push_back (string (line));
175- m_currentHistory = m_history.size ();
181+ if (line && line[0 ])
182+ {
183+ m_history.push_back (string (line));
184+ m_currentHistory = m_history.size ();
185+ }
186+
176187 m_historyIter = m_history.end ();
177188 m_changes.clear ();
178189}
@@ -193,6 +204,14 @@ LRESULT ConsoleDialog::inputWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
193204
194205LRESULT ConsoleDialog::run_inputWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
195206{
207+
208+ #ifdef _DEBUG
209+ {
210+ TCHAR outputbuffer[500 ];
211+ _sntprintf_s (outputbuffer, 500 , 500 , _T (" Message: %ud W:%ld L:%ld\n " ), message, wParam, lParam);
212+ OutputDebugString (outputbuffer);
213+ }
214+ #endif
196215 switch (message)
197216 {
198217 case WM_KEYDOWN:
@@ -206,6 +225,19 @@ LRESULT ConsoleDialog::run_inputWndProc(HWND hWnd, UINT message, WPARAM wParam,
206225 historyNext ();
207226 return FALSE ;
208227
228+
229+ default :
230+ return CallWindowProc (m_originalInputWndProc, hWnd, message, wParam, lParam);
231+ }
232+ break ;
233+
234+ case WM_KEYUP:
235+ switch (wParam)
236+ {
237+ case VK_RETURN:
238+ runStatement ();
239+ return FALSE ;
240+
209241 case VK_ESCAPE:
210242 historyEnd ();
211243 return FALSE ;
@@ -235,6 +267,12 @@ void ConsoleDialog::runStatement()
235267}
236268
237269
270+ void ConsoleDialog::stopStatement ()
271+ {
272+ m_console->stopStatement ();
273+ }
274+
275+
238276void ConsoleDialog::setPrompt (const char *prompt)
239277{
240278 m_prompt = prompt;
@@ -287,7 +325,10 @@ void ConsoleDialog::doDialog()
287325
288326void ConsoleDialog::runEnabled (bool enabled)
289327{
290- EnableWindow (GetDlgItem (_hSelf, IDC_RUN), enabled);
328+ // EnableWindow(GetDlgItem(_hSelf, IDC_RUN), enabled);
329+ ::SetWindowText (GetDlgItem(_hSelf, IDC_RUN), enabled ? _T(" Run" ) : _T(" Stop" ));
330+ m_runButtonIsRun = enabled;
331+
291332 if (enabled)
292333 {
293334 ::SetForegroundWindow (_hSelf);
0 commit comments