From 14daca9ccfef2f4b1c8ff063d2cb540a18bc48b2 Mon Sep 17 00:00:00 2001
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Date: Tue, 12 Jan 2021 13:34:52 -0600
Subject: [PATCH] Fix usermenu and macro system() calls disrupting terminal.
---
src/usermenu.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/usermenu.c b/src/usermenu.c
index 698244220..f5cf03686 100644
a
|
b
|
execute_menu_command (const WEdit * edit_widget, const char *commands, gboolean |
559 | 559 | |
560 | 560 | if (show_prompt) |
561 | 561 | shell_execute (cmd, EXECUTE_HIDE); |
562 | | else if (system (cmd) == -1) |
563 | | message (D_ERROR, MSG_ERROR, "%s", _("Error calling program")); |
| 562 | else |
| 563 | { |
| 564 | gboolean ok; |
564 | 565 | |
| 566 | /* Prepare the terminal by setting its flag to the initial ones. This will cause \r to |
| 567 | ork as |
| 568 | * expected, instead of being ignored. */ |
| 569 | tty_reset_shell_mode (); |
| 570 | |
| 571 | ok = (system (cmd) != -1); |
| 572 | |
| 573 | /* Restore the SLang terminal configuration and redraw the editor. */ |
| 574 | tty_raw_mode (); |
| 575 | |
| 576 | /* Redraw the original screen's contents. */ |
| 577 | clr_scr (); |
| 578 | repaint_screen (); |
| 579 | |
| 580 | if (!ok) |
| 581 | message (D_ERROR, MSG_ERROR, "%s", _("Error calling program")); |
| 582 | } |
| 583 | |
565 | 584 | g_free (cmd); |
566 | 585 | } |
567 | 586 | mc_unlink (file_name_vpath); |