Ticket #4188: mc_fish_first_command.diff

File mc_fish_first_command.diff, 2.2 KB (added by pronobis, 18 months ago)
Line 
1diff --git a/src/subshell/common.c b/src/subshell/common.c
2index cb8bbe3f1..8b623fdd6 100644
3@@ -1441,18 +1442,12 @@ invoke_subshell (const char *command, int how, vfs_path_t ** new_dir_vpath)
4     }
5     else                        /* MC has passed us a user command */
6     {
7-        /* Before we write to the command prompt, we need to clear whatever */
8-        /* data is there, but only if we are using one of the shells that */
9-        /* doesn't support keeping command buffer contents, OR if there was */
10-        /* some sort of error. */
11-        if (!use_persistent_buffer || subshell_should_clear_command_line)
12+        /* Hack to make fish shell process the first command after window resize. */
13+        if (subshell_ready)
14         {
15-            write_all (mc_global.tty.subshell_pty, "\003", 1);
16-            subshell_state = RUNNING_COMMAND;
17-            /* We need to call feed_subshell here if we are using fish, because of a quirk
18-             * in the behavioral of that particular shell. */
19-            if (mc_global.shell->type != SHELL_FISH)
20-                feed_subshell (QUIETLY, FALSE);
21+          write_all (mc_global.tty.subshell_pty,  " \n", 2);
22+          subshell_state = RUNNING_COMMAND;
23+          feed_subshell (VISIBLY, FALSE);
24         }
25 
26         if (how == QUIETLY)
27@@ -1655,15 +1650,11 @@ do_subshell_chdir (const vfs_path_t * vpath, gboolean update_prompt)
28         return;
29     }
30 
31-    /* If we are using a shell that doesn't support persistent command buffer, we need to clear
32-     * the command prompt before we send the cd command. */
33-    if (!use_persistent_buffer || subshell_should_clear_command_line)
34-    {
35-        write_all (mc_global.tty.subshell_pty, "\003", 1);
36-        subshell_state = RUNNING_COMMAND;
37-        if (mc_global.shell->type != SHELL_FISH)
38-            feed_subshell (QUIETLY, FALSE);
39-    }
40+    /* Hack to make fish shell process the first cd after window resize. */
41+    write_all (mc_global.tty.subshell_pty, " \n", 2);
42+    subshell_state = RUNNING_COMMAND;
43+    feed_subshell (QUIETLY, FALSE);
44+
45     /* The initial space keeps this out of the command history (in bash
46        because we set "HISTCONTROL=ignorespace") */
47     write_all (mc_global.tty.subshell_pty, " cd ", 4);