Browse Source

The prefix must begin on the start of line.

git-svn-id: https://klish.googlecode.com/svn/trunk@184 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
9ebe716536
1 changed files with 3 additions and 4 deletions
  1. 3 4
      clish/nspace/nspace.c

+ 3 - 4
clish/nspace/nspace.c

@@ -157,15 +157,14 @@ static const char *clish_nspace_after_prefix(const char *prefix,
 	regcomp(&regexp, prefix, REG_EXTENDED | REG_ICASE);
 	res = regexec(&regexp, line, 1, pmatch, 0);
 	regfree(&regexp);
-	if (res || (-1 == pmatch[0].rm_so))
+	if (res || (0 != pmatch[0].rm_so))
 		return NULL;
 	/* Empty match */
-	if (pmatch[0].rm_so == pmatch[0].rm_eo)
+	if (0 == pmatch[0].rm_eo)
 		return NULL;
 	in_line = line + pmatch[0].rm_eo;
 
-	lub_string_catn(real_prefix, line + pmatch[0].rm_so,
-		pmatch[0].rm_eo - pmatch[0].rm_so);
+	lub_string_catn(real_prefix, line, pmatch[0].rm_eo);
 
 	return in_line;
 }