Pārlūkot izejas kodu

Fix autocompletion using space.

git-svn-id: https://klish.googlecode.com/svn/trunk@366 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 gadi atpakaļ
vecāks
revīzija
583822faef
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 7 1
      clish/shell/shell_tinyrl.c

+ 7 - 1
clish/shell/shell_tinyrl.c

@@ -166,6 +166,9 @@ static bool_t clish_shell_tinyrl_key_space(tinyrl_t * this, int key)
 		/* if we are in the middle of a quote then simply enter a space */
 		result = BOOL_TRUE;
 	} else {
+		/* Find out if current line is legal. It can be
+		 * fully completed or partially completed.
+		 */
 		arg_status = clish_shell_parse(context->shell,
 			line, &cmd, &pargv);
 		if (pargv)
@@ -177,6 +180,10 @@ static bool_t clish_shell_tinyrl_key_space(tinyrl_t * this, int key)
 				result = BOOL_TRUE;
 			break;
 		default:
+			break;
+		}
+		/* If current line is illegal try to make auto-comletion. */
+		if (!result) {
 			/* perform word completion */
 			status = clish_shell_tinyrl_complete(this);
 			switch (status) {
@@ -200,7 +207,6 @@ static bool_t clish_shell_tinyrl_key_space(tinyrl_t * this, int key)
 				result = BOOL_TRUE;
 				break;
 			}
-			break;
 		}
 	}
 	if (result)