diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2009-12-28 18:46:17 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2009-12-28 18:52:29 +0100 |
commit | 50bd3ec6e2a8f0d9c5073aad0f9b0b997fcc4ccb (patch) | |
tree | 69f9a79d0b5d4a31e5d03bb7ad13f301180e0608 /plugins | |
parent | 5dfac08f5ab93c46d0479971496e7252248c84b2 (diff) |
fixed few issues with cursor positioning
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gtkui/callbacks.c | 3 | ||||
-rw-r--r-- | plugins/gtkui/search.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index 8d82b8c4..31bdb4e8 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -517,6 +517,9 @@ on_remove1_activate (GtkMenuItem *menuitem, gtkplaylist_t *ps = &main_playlist; GtkWidget *widget = ps->playlist; int row = deadbeef->pl_delete_selected (); + if (row >= ps->get_count ()) { + row = ps->get_count ()-1; + } deadbeef->pl_set_cursor (PL_MAIN, row); if (row != -1) { DB_playItem_t *it = deadbeef->pl_get_for_idx (row); diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c index 55b5ad3f..c07d503f 100644 --- a/plugins/gtkui/search.c +++ b/plugins/gtkui/search.c @@ -74,6 +74,10 @@ on_searchentry_changed (GtkEditable *editable, extern gtkplaylist_t search_playlist; gtkplaylist_t *ps = &search_playlist; + int row = deadbeef->pl_get_cursor (ps->iterator); + if (row >= ps->get_count ()) { + deadbeef->pl_set_cursor (ps->iterator, ps->get_count () - 1); + } gtkpl_setup_scrollbar (ps); //memset (ps->fmtcache, 0, sizeof (int16_t) * 3 * pl_ncolumns * ps->nvisiblerows); gtkpl_draw_playlist (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height); |