-rw-r--r-- | fox-gui/fx_console.cpp | 22 | ||||
-rw-r--r-- | fox-gui/gsl_shell_interp.cpp | 3 | ||||
-rw-r--r-- | fox-gui/gsl_shell_interp.h | 2 |
diff --git a/fox-gui/fx_console.cpp b/fox-gui/fx_console.cpp index cf5afbc8..68342677 100644 --- a/fox-gui/fx_console.cpp +++ b/fox-gui/fx_console.cpp @@ -153,11 +153,18 @@ long fx_console::on_key_press(FXObject* obj, FXSelector sel, void* ptr) setCursorPos(m_input_begin + line_len); appendText("\n"); - const char* input_line = m_input.text(); - m_history.add(input_line); - - this->m_status = output_mode; - m_engine->set_request(gsl_shell_thread::execute_request, input_line); + if (m_input == "exit") + { + FXApp* app = getApp(); + app->handle(this, FXSEL(SEL_COMMAND, gsl_shell_app::ID_CONSOLE_CLOSE), NULL); + } + else + { + const char* input_line = m_input.text(); + m_history.add(input_line); + this->m_status = output_mode; + m_engine->set_request(gsl_shell_thread::execute_request, input_line); + } return 1; } @@ -232,11 +239,6 @@ long fx_console::on_lua_output(FXObject* obj, FXSelector sel, void* ptr) { m_status = input_mode; } - else if (status == gsl_shell::exit_request) - { - FXApp* app = getApp(); - app->handle(this, FXSEL(SEL_COMMAND,FXApp::ID_QUIT), NULL); - } else { show_errors(); diff --git a/fox-gui/gsl_shell_interp.cpp b/fox-gui/gsl_shell_interp.cpp index 6cd077e5..faf85d86 100644 --- a/fox-gui/gsl_shell_interp.cpp +++ b/fox-gui/gsl_shell_interp.cpp @@ -166,9 +166,6 @@ int gsl_shell::exec(const char *line) lua_State* L = this->L; size_t len = strlen(line); - if (strcmp (line, "exit") == 0) - return exit_request; - /* try to load the string as an expression */ int status = yield_expr(L, line, len); diff --git a/fox-gui/gsl_shell_interp.h b/fox-gui/gsl_shell_interp.h index c61a5373..52a8135d 100644 --- a/fox-gui/gsl_shell_interp.h +++ b/fox-gui/gsl_shell_interp.h @@ -14,7 +14,7 @@ extern "C" { class gsl_shell : public gsl_shell_state { public: - enum eval_result_e { eval_success, eval_error, incomplete_input, exit_request }; + enum eval_result_e { eval_success, eval_error, incomplete_input }; gsl_shell() { |