diff options
Diffstat (limited to 'fluid/shell_command.cxx')
| -rw-r--r-- | fluid/shell_command.cxx | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/fluid/shell_command.cxx b/fluid/shell_command.cxx index 79b1609e8..28382636b 100644 --- a/fluid/shell_command.cxx +++ b/fluid/shell_command.cxx @@ -384,6 +384,22 @@ static void expand_macros(Fl_String &cmd) { } /** + Show the terminal window where it was last positioned. + */ +void show_terminal_window() { + Fl_Preferences pos(fluid_prefs, "shell_run_Window_pos"); + int x, y, w, h; + pos.get("x", x, -1); + pos.get("y", y, 0); + pos.get("w", w, 640); + pos.get("h", h, 480); + if (x!=-1) { + shell_run_window->resize(x, y, w, h); + } + shell_run_window->show(); +} + +/** Prepare for and run a shell command. \param[in] cmd the command that is sent to `/bin/sh -c ...` or `cmd.exe` on Windows machines @@ -400,20 +416,17 @@ void run_shell_command(const Fl_String &cmd, int flags) { Fl_String expanded_cmd = cmd; expand_macros(expanded_cmd); - if (!shell_run_window->visible()) { - Fl_Preferences pos(fluid_prefs, "shell_run_Window_pos"); - int x, y, w, h; - pos.get("x", x, -1); - pos.get("y", y, 0); - pos.get("w", w, 640); - pos.get("h", h, 480); - if (x!=-1) { - shell_run_window->resize(x, y, w, h); - } - shell_run_window->show(); + if ( ((flags & Fd_Shell_Command::DONT_SHOW_TERMINAL) == 0) + && (!shell_run_window->visible())) + { + show_terminal_window(); } // Show the output window and clear things... + if (flags & Fd_Shell_Command::CLEAR_TERMINAL) + shell_run_terminal->printf("\033[2J\033[H"); + if (flags & Fd_Shell_Command::CLEAR_HISTORY) + shell_run_terminal->printf("\033[3J"); shell_run_terminal->printf("\033[0;32m%s\033[0m\n", expanded_cmd.c_str()); shell_run_window->label(expanded_cmd.c_str()); |
