* command.c (enter): Don't change current_dlg to NULL. It
breaks repainting of the panels. Simplify logic.
Этот коммит содержится в:
родитель
8c10c20881
Коммит
6da33f9c8c
@ -1,5 +1,8 @@
|
|||||||
2003-10-25 Pavel Roskin <proski@gnu.org>
|
2003-10-25 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* command.c (enter): Don't change current_dlg to NULL. It
|
||||||
|
breaks repainting of the panels. Simplify logic.
|
||||||
|
|
||||||
* key.c (init_key_x11): Warning fix for gcc 3.3.2.
|
* key.c (init_key_x11): Warning fix for gcc 3.3.2.
|
||||||
|
|
||||||
2003-10-24 Pavel Roskin <proski@gnu.org>
|
2003-10-24 Pavel Roskin <proski@gnu.org>
|
||||||
|
126
src/command.c
126
src/command.c
@ -171,80 +171,76 @@ void do_cd_command (char *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns 1 if the we could handle the enter, 0 if not */
|
/* Handle Enter on the command line */
|
||||||
static int
|
static cb_ret_t
|
||||||
enter (WInput *cmdline)
|
enter (WInput *cmdline)
|
||||||
{
|
{
|
||||||
Dlg_head *old_dlg;
|
char *cmd = cmdline->buffer;
|
||||||
|
|
||||||
if (command_prompt && strlen (cmdline->buffer)) {
|
if (!command_prompt)
|
||||||
char *cmd;
|
return MSG_HANDLED;
|
||||||
|
|
||||||
/* Any initial whitespace should be removed at this point */
|
/* Any initial whitespace should be removed at this point */
|
||||||
cmd = cmdline->buffer;
|
while (*cmd == ' ' || *cmd == '\t' || *cmd == '\n')
|
||||||
while (*cmd == ' ' || *cmd == '\t' || *cmd == '\n')
|
cmd++;
|
||||||
cmd++;
|
|
||||||
|
|
||||||
if (strncmp (cmd, "cd ", 3) == 0 || strcmp (cmd, "cd") == 0) {
|
if (!*cmd)
|
||||||
do_cd_command (cmd);
|
return MSG_HANDLED;
|
||||||
new_input (cmdline);
|
|
||||||
return MSG_HANDLED;
|
|
||||||
} else {
|
|
||||||
char *command, *s;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
if (!vfs_current_is_local ()) {
|
if (strncmp (cmd, "cd ", 3) == 0 || strcmp (cmd, "cd") == 0) {
|
||||||
message (1, MSG_ERROR,
|
do_cd_command (cmd);
|
||||||
_
|
new_input (cmdline);
|
||||||
(" Cannot execute commands on non-local filesystems"));
|
return MSG_HANDLED;
|
||||||
|
} else {
|
||||||
|
char *command, *s;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
return MSG_NOT_HANDLED;
|
if (!vfs_current_is_local ()) {
|
||||||
}
|
message (1, MSG_ERROR,
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
_
|
||||||
/* Check this early before we clean command line
|
(" Cannot execute commands on non-local filesystems"));
|
||||||
* (will be checked again by shell_execute) */
|
|
||||||
if (use_subshell && subshell_state != INACTIVE) {
|
|
||||||
message (1, MSG_ERROR,
|
|
||||||
_(" The shell is already running a command "));
|
|
||||||
return MSG_NOT_HANDLED;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
command = g_malloc (strlen (cmd) + 1);
|
return MSG_NOT_HANDLED;
|
||||||
command[0] = 0;
|
|
||||||
for (i = j = 0; i < strlen (cmd); i++) {
|
|
||||||
if (cmd[i] == '%') {
|
|
||||||
i++;
|
|
||||||
s = expand_format (NULL, cmd[i], 1);
|
|
||||||
command =
|
|
||||||
g_realloc (command, strlen (command) + strlen (s)
|
|
||||||
+ strlen (cmd) - i + 1);
|
|
||||||
strcat (command, s);
|
|
||||||
g_free (s);
|
|
||||||
j = strlen (command);
|
|
||||||
} else {
|
|
||||||
command[j] = cmd[i];
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
command[j] = 0;
|
|
||||||
}
|
|
||||||
old_dlg = current_dlg;
|
|
||||||
current_dlg = 0;
|
|
||||||
new_input (cmdline);
|
|
||||||
shell_execute (command, 0);
|
|
||||||
g_free (command);
|
|
||||||
|
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
||||||
if (quit & SUBSHELL_EXIT) {
|
|
||||||
quiet_quit_cmd ();
|
|
||||||
return MSG_HANDLED;
|
|
||||||
}
|
|
||||||
if (use_subshell)
|
|
||||||
load_prompt (0, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
current_dlg = old_dlg;
|
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
|
/* Check this early before we clean command line
|
||||||
|
* (will be checked again by shell_execute) */
|
||||||
|
if (use_subshell && subshell_state != INACTIVE) {
|
||||||
|
message (1, MSG_ERROR,
|
||||||
|
_(" The shell is already running a command "));
|
||||||
|
return MSG_NOT_HANDLED;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
command = g_malloc (strlen (cmd) + 1);
|
||||||
|
command[0] = 0;
|
||||||
|
for (i = j = 0; i < strlen (cmd); i++) {
|
||||||
|
if (cmd[i] == '%') {
|
||||||
|
i++;
|
||||||
|
s = expand_format (NULL, cmd[i], 1);
|
||||||
|
command = g_realloc (command, strlen (command) + strlen (s)
|
||||||
|
+ strlen (cmd) - i + 1);
|
||||||
|
strcat (command, s);
|
||||||
|
g_free (s);
|
||||||
|
j = strlen (command);
|
||||||
|
} else {
|
||||||
|
command[j] = cmd[i];
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
command[j] = 0;
|
||||||
|
}
|
||||||
|
new_input (cmdline);
|
||||||
|
shell_execute (command, 0);
|
||||||
|
g_free (command);
|
||||||
|
|
||||||
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
|
if (quit & SUBSHELL_EXIT) {
|
||||||
|
quiet_quit_cmd ();
|
||||||
|
return MSG_HANDLED;
|
||||||
|
}
|
||||||
|
if (use_subshell)
|
||||||
|
load_prompt (0, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return MSG_HANDLED;
|
return MSG_HANDLED;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user