diff --git a/src/usermenu.c b/src/usermenu.c index 1fecbeaac..941556111 100644 --- a/src/usermenu.c +++ b/src/usermenu.c @@ -559,8 +559,26 @@ execute_menu_command (const WEdit * edit_widget, const char *commands, gboolean if (show_prompt) shell_execute (cmd, EXECUTE_HIDE); - else if (system (cmd) == -1) - message (D_ERROR, MSG_ERROR, "%s", _("Error calling program")); + else + { + gboolean ok; + + /* Prepare the terminal by setting its flag to the initial ones. This will cause \r + * to work as expected, instead of being ignored. */ + tty_reset_shell_mode (); + + ok = (system (cmd) != -1); + + /* Restore terminal configuration. */ + tty_raw_mode (); + + /* Redraw the original screen's contents. */ + tty_clear_screen (); + repaint_screen (); + + if (!ok) + message (D_ERROR, MSG_ERROR, "%s", _("Error calling program")); + } g_free (cmd); } @@ -1026,7 +1044,7 @@ user_menu_cmd (const WEdit * edit_widget, const char *menu_file, int selected_en switch (*p) { case '#': - /* show prompt if first line of external script is #interactive */ + /* do not show prompt if first line of external script is #silent */ if (selected_entry >= 0 && strncmp (p, "#silent", 7) == 0) interactive = FALSE; /* A commented menu entry */