소스 검색

Fix autocompletion using space.

git-svn-id: https://klish.googlecode.com/svn/trunk@366 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 년 전
부모
커밋
583822faef
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  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)