From: Max Kellermann Date: Sat, 10 Oct 2009 15:45:13 +0000 (+0200) Subject: list_window: use list_window_move_cursor() in find functions X-Git-Tag: release-0.16~139 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=660e6d3f46c3ba1da1e84214919943cba48fe3f2;p=ncmpc.git list_window: use list_window_move_cursor() in find functions Don't repeat the range selection code. --- 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; } }