Commit 610c68d8 authored by Rafaël Carré's avatar Rafaël Carré

ncurses: add ';' shortcut to search next item

parent 9d759fed
...@@ -206,7 +206,6 @@ struct intf_sys_t ...@@ -206,7 +206,6 @@ struct intf_sys_t
/* Search Box context */ /* Search Box context */
char search_chain[20]; char search_chain[20];
int before_search;
/* Open Box Context */ /* Open Box Context */
char open_chain[50]; char open_chain[50];
...@@ -465,16 +464,15 @@ static int SubSearchPlaylist(intf_sys_t *sys, char *searchstring, ...@@ -465,16 +464,15 @@ static int SubSearchPlaylist(intf_sys_t *sys, char *searchstring,
return -1; return -1;
} }
static void SearchPlaylist(intf_sys_t *sys, char *str) static void SearchPlaylist(intf_sys_t *sys)
{ {
int i_first = sys->before_search; char *str = sys->search_chain;
int i_first = sys->box_idx;
if (i_first < 0) if (i_first < 0)
i_first = 0; i_first = 0;
if (!str || !*str) { if (!str || !*str)
sys->box_idx = sys->before_search;
return; return;
}
int i_item = SubSearchPlaylist(sys, str, i_first + 1, sys->plist_entries); int i_item = SubSearchPlaylist(sys, str, i_first + 1, sys->plist_entries);
if (i_item < 0) if (i_item < 0)
...@@ -909,6 +907,7 @@ static int DrawHelp(intf_thread_t *intf) ...@@ -909,6 +907,7 @@ static int DrawHelp(intf_thread_t *intf)
H(_(" O Reverse order Playlist by title")); H(_(" O Reverse order Playlist by title"));
H(_(" g Go to the current playing item")); H(_(" g Go to the current playing item"));
H(_(" / Look for an item")); H(_(" / Look for an item"));
H(_(" ; Look for the next item"));
H(_(" A Add an entry")); H(_(" A Add an entry"));
/* xgettext: You can use ⌫ character to translate <backspace> */ /* xgettext: You can use ⌫ character to translate <backspace> */
H(_(" D, <backspace>, <del> Delete an entry")); H(_(" D, <backspace>, <del> Delete an entry"));
...@@ -1311,6 +1310,10 @@ static bool HandlePlaylistKey(intf_thread_t *intf, int key) ...@@ -1311,6 +1310,10 @@ static bool HandlePlaylistKey(intf_thread_t *intf, int key)
vlc_mutex_unlock(&sys->pl_lock); vlc_mutex_unlock(&sys->pl_lock);
return true; return true;
case ';':
SearchPlaylist(sys);
return true;
case 'g': case 'g':
FindIndex(sys, p_playlist); FindIndex(sys, p_playlist);
return true; return true;
...@@ -1491,7 +1494,7 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box) ...@@ -1491,7 +1494,7 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box)
case '\r': case '\r':
case '\n': case '\n':
if (search) if (search)
SearchPlaylist(sys, sys->search_chain); SearchPlaylist(sys);
else else
OpenSelection(intf); OpenSelection(intf);
...@@ -1513,10 +1516,7 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box) ...@@ -1513,10 +1516,7 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box)
* following function-key sequence. * following function-key sequence.
* *
*/ */
if (getch() != ERR) if (getch() == ERR)
return;
if (search) sys->box_idx = sys->before_search;
sys->box_type = BOX_PLAYLIST; sys->box_type = BOX_PLAYLIST;
return; return;
...@@ -1534,7 +1534,7 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box) ...@@ -1534,7 +1534,7 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box)
} }
if (search) if (search)
SearchPlaylist(sys, str); SearchPlaylist(sys);
} }
static void InputNavigate(input_thread_t* p_input, const char *var) static void InputNavigate(input_thread_t* p_input, const char *var)
...@@ -1572,20 +1572,11 @@ static void HandleCommonKey(intf_thread_t *intf, int key) ...@@ -1572,20 +1572,11 @@ static void HandleCommonKey(intf_thread_t *intf, int key)
case '/': /* Search */ case '/': /* Search */
sys->plidx_follow = false; sys->plidx_follow = false;
if (sys->box_type == BOX_PLAYLIST) {
sys->before_search = sys->box_idx;
sys->box_type = BOX_SEARCH;
} else {
sys->before_search = 0;
BoxSwitch(sys, BOX_SEARCH); BoxSwitch(sys, BOX_SEARCH);
}
return; return;
case 'A': /* Open */ case 'A': /* Open */
sys->open_chain[0] = '\0'; sys->open_chain[0] = '\0';
if (sys->box_type == BOX_PLAYLIST)
sys->box_type = BOX_OPEN;
else
BoxSwitch(sys, BOX_OPEN); BoxSwitch(sys, BOX_OPEN);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment