From 660e6d3f46c3ba1da1e84214919943cba48fe3f2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Oct 2009 17:45:13 +0200 Subject: [PATCH] list_window: use list_window_move_cursor() in find functions Don't repeat the range selection code. --- src/list_window.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/list_window.c b/src/list_window.c index c3ecc72..d7da155 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -464,11 +464,7 @@ list_window_find(struct list_window *lw, assert(label != NULL); if (str && label && match_line(label, str)) { - lw->selected = i; - if(!lw->range_selection || i > lw->selected_end) - lw->selected_end = i; - if(!lw->range_selection || i < lw->selected_start) - lw->selected_start = i; + list_window_move_cursor(lw, i); return true; } if (wrap && i == lw->selected) @@ -509,11 +505,7 @@ list_window_rfind(struct list_window *lw, assert(label != NULL); if( str && label && match_line(label, str) ) { - lw->selected = i; - if(!lw->range_selection || i > (int)lw->selected_end) - lw->selected_end = i; - if(!lw->range_selection || i < (int)lw->selected_start) - lw->selected_start = i; + list_window_move_cursor(lw, i); return true; } if (wrap && i == (int)lw->selected) @@ -554,11 +546,7 @@ list_window_jump(struct list_window *lw, if (str && label && g_ascii_strncasecmp(label, str, strlen(str)) == 0) #endif { - lw->selected = i; - if(!lw->range_selection || i > lw->selected_end) - lw->selected_end = i; - if(!lw->range_selection || i < lw->selected_start) - lw->selected_start = i; + list_window_move_cursor(lw, i); return true; } } -- 2.30.2