From 19493b9518ba74cc67de9b1a276043821c346904 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 7 Oct 2009 13:43:51 +0300 Subject: [PATCH] Some fixies for optimization. Signed-off-by: Slava Zanko --- src/widget.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/widget.c b/src/widget.c index b3f9be8fd..816a6d8fe 100644 --- a/src/widget.c +++ b/src/widget.c @@ -1385,27 +1385,29 @@ forward_word (WInput * in) static void 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')) { - p--; - in->point--; - } + for ( + p = in->buffer + str_offset_to_pos (in->buffer, in->point); + (p != in->buffer) && (p[0] == '\0'); + p-- , in->point-- + ); while (p != in->buffer) { + p_tmp = p; str_cprev_char (&p); if (!str_isspace (p) && !str_ispunct (p)) { - str_cnext_char (&p); + p = p_tmp; break; } in->point--; } while (p != in->buffer) { str_cprev_char (&p); - if (str_isspace (p) || str_ispunct (p)) { - str_cnext_char (&p); + if (str_isspace (p) || str_ispunct (p)) break; - } + in->point--; } }