Some fixies for optimization.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-10-07 13:43:51 +03:00 committed by Ilia Maslakov
parent 51771e0092
commit 19493b9518

View File

@ -1385,27 +1385,29 @@ forward_word (WInput * in)
static void static void
backward_word (WInput *in) backward_word (WInput *in)
{ {
const char *p = in->buffer + str_offset_to_pos (in->buffer, in->point); const char *p;
const char *p_tmp;
while ((p != in->buffer) && (p[0] == '\0')) { for (
p--; p = in->buffer + str_offset_to_pos (in->buffer, in->point);
in->point--; (p != in->buffer) && (p[0] == '\0');
} p-- , in->point--
);
while (p != in->buffer) { while (p != in->buffer) {
p_tmp = p;
str_cprev_char (&p); str_cprev_char (&p);
if (!str_isspace (p) && !str_ispunct (p)) { if (!str_isspace (p) && !str_ispunct (p)) {
str_cnext_char (&p); p = p_tmp;
break; break;
} }
in->point--; in->point--;
} }
while (p != in->buffer) { while (p != in->buffer) {
str_cprev_char (&p); str_cprev_char (&p);
if (str_isspace (p) || str_ispunct (p)) { if (str_isspace (p) || str_ispunct (p))
str_cnext_char (&p);
break; break;
}
in->point--; in->point--;
} }
} }