From 3be17f665754b8c5a1f304f650a3cffbcb245126 Mon Sep 17 00:00:00 2001 From: Leonard den Ottolander Date: Sun, 29 May 2005 11:54:22 +0000 Subject: [PATCH] main.c: Fix blocking of panel cd-ing when there are only spaces on the command line. --- src/ChangeLog | 5 +++++ src/main.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index aa98cf891..7eec72257 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-05-29 Jindrich Novy + + * main.c (midnight_callback): Fix blocking of panel cd-ing when + there are only spaces on the command line. + 2005-05-26 Roland Illig * view.c: Completely rewrote the cursor movement code. Now all diff --git a/src/main.c b/src/main.c index 33879ae77..0a7d36a73 100644 --- a/src/main.c +++ b/src/main.c @@ -1487,9 +1487,14 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm) if (parm == '\t') free_completions (cmdline); - if (parm == '\n' && cmdline->buffer[0]) { - send_message ((Widget *) cmdline, WIDGET_KEY, parm); - return MSG_HANDLED; + if (parm == '\n') { + for (i = 0; cmdline->buffer[i] && cmdline->buffer[i] == ' '; i++); + if (cmdline->buffer[i]) { + send_message ((Widget *) cmdline, WIDGET_KEY, parm); + return MSG_HANDLED; + } + stuff (cmdline, "", 0); + cmdline->point = 0; } /* Ctrl-Enter and Alt-Enter */ @@ -1524,7 +1529,7 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm) reverse_selection_cmd (); return MSG_HANDLED; } - } else if (!command_prompt || !strlen (cmdline->buffer)) { + } else if (!command_prompt || !cmdline->buffer[0]) { /* Special treatement '+', '-', '\', '*' only when this is * first char on input line */