From 7e8975e022d613f8da0ea593de04d9e1f0e684cc Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 18 Feb 2010 17:18:51 +0200 Subject: [PATCH] quicksearch: stop appending of chars if no file found Signed-off-by: Slava Zanko --- src/screen.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/screen.c b/src/screen.c index 16607cfdd..814334fca 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2199,6 +2199,7 @@ do_search (WPanel *panel, int c_code) char *act; mc_search_t *search; char *reg_exp; + gboolean is_found = FALSE; l = strlen (panel->search_buffer); if (c_code == KEY_BACKSPACE) { @@ -2249,9 +2250,20 @@ do_search (WPanel *panel, int c_code) 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) { + if (c_code != KEY_BACKSPACE) { + act = panel->search_buffer + l; + str_prev_noncomb_char (&act, panel->search_buffer); + act[0] = '\0'; + } + mc_search_free (search); + g_free (reg_exp); + return; + } unselect_item (panel); panel->selected = sel;