From be05d210c325f539c17dd62d7ba305d64cc91ae7 Mon Sep 17 00:00:00 2001 From: Ilia Maslakov Date: Fri, 19 Feb 2010 10:33:11 +0300 Subject: [PATCH] cleanup of screen.c: do_search() function (indentation and trailing whitespace) Signed-off-by: Ilia Maslakov --- src/screen.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/screen.c b/src/screen.c index adbff83a0..dc25ce990 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2203,7 +2203,7 @@ do_search (WPanel *panel, int c_code) l = strlen (panel->search_buffer); if (c_code == KEY_BACKSPACE) { - if (l != 0) { + if (l != 0) { act = panel->search_buffer + l; str_prev_noncomb_char (&act, panel->search_buffer); act[0] = '\0'; @@ -2213,25 +2213,25 @@ do_search (WPanel *panel, int c_code) if (c_code != 0 && (gsize) panel->search_chpoint < sizeof (panel->search_char)) { panel->search_char[panel->search_chpoint] = c_code; panel->search_chpoint++; - } - + } + if (panel->search_chpoint > 0) { switch (str_is_valid_char (panel->search_char, panel->search_chpoint)) { - case -2: - return; - case -1: + case -2: + return; + case -1: + panel->search_chpoint = 0; + return; + default: + if (l + panel->search_chpoint < sizeof (panel->search_buffer)) { + memcpy (panel->search_buffer + l, panel->search_char, + panel->search_chpoint); + l+= panel->search_chpoint; + (panel->search_buffer + l)[0] = '\0'; panel->search_chpoint = 0; - return; - default: - if (l + panel->search_chpoint < sizeof (panel->search_buffer)) { - memcpy (panel->search_buffer + l, panel->search_char, - panel->search_chpoint); - l+= panel->search_chpoint; - (panel->search_buffer + l)[0] = '\0'; - panel->search_chpoint = 0; } - } - } + } + } } reg_exp = g_strdup_printf ("%s*", panel->search_buffer); @@ -2243,18 +2243,18 @@ do_search (WPanel *panel, int c_code) sel = panel->selected; for (i = panel->selected; !wrapped || i != panel->selected; i++) { - if (i >= panel->count) { - i = 0; - if (wrapped) - break; - wrapped = TRUE; - } + if (i >= panel->count) { + i = 0; + if (wrapped) + break; + wrapped = TRUE; + } if (mc_search_run (search, panel->dir.list[i].fname, 0, panel->dir.list[i].fnamelen, NULL)) { sel = i; is_found = TRUE; break; - } + } } if (is_found) { unselect_item (panel);