Ticket #4171: 0001-Fix-usermenu-and-macro-system-calls-disrupting-termi.patch

File 0001-Fix-usermenu-and-macro-system-calls-disrupting-termi.patch, 1.4 KB (added by psprint, 4 years ago)

The mccore-wide version of the patch.

  • src/usermenu.c

    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 
    559559 
    560560        if (show_prompt) 
    561561            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; 
    564565 
     566            /* Prepare the terminal by setting its flag to the initial ones. This will cause \r to  
     567ork 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  
    565584        g_free (cmd); 
    566585    } 
    567586    mc_unlink (file_name_vpath);