Compare commits
No commits in common. "5aa07fd8af21907eea86ca62e42c8e6768115fad" and "1a671dfad5062ba265e873f7353c7d682943af98" have entirely different histories.
5aa07fd8af
...
1a671dfad5
36
nncmpp.c
36
nncmpp.c
@ -154,8 +154,6 @@ xbasename (const char *path)
|
||||
return last_slash ? last_slash + 1 : path;
|
||||
}
|
||||
|
||||
static char *xstrdup0 (const char *s) { return s ? xstrdup (s) : NULL; }
|
||||
|
||||
static char *
|
||||
latin1_to_utf8 (const char *latin1)
|
||||
{
|
||||
@ -4366,7 +4364,7 @@ mpd_find_pos_of_id (const char *desired_id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char *
|
||||
static char *
|
||||
mpd_id_of_pos (int pos)
|
||||
{
|
||||
compact_map_t map = item_list_get (&g.playlist, pos);
|
||||
@ -4376,39 +4374,29 @@ mpd_id_of_pos (int pos)
|
||||
static void
|
||||
mpd_process_info (const struct strv *data)
|
||||
{
|
||||
struct tab *tab = &g_current_tab;
|
||||
char *prev_sel_id = xstrdup0 (mpd_id_of_pos (tab->item_selected));
|
||||
char *prev_mark_id = xstrdup0 (mpd_id_of_pos (tab->item_mark));
|
||||
char *fallback_id = NULL;
|
||||
|
||||
struct tab_range r = tab_selection_range (g.active_tab);
|
||||
if (r.upto >= 0)
|
||||
{
|
||||
if (!(fallback_id = xstrdup0 (mpd_id_of_pos (r.upto + 1))))
|
||||
fallback_id = xstrdup0 (mpd_id_of_pos (r.from - 1));
|
||||
}
|
||||
int *selected = &g_current_tab.item_selected;
|
||||
int *marked = &g_current_tab.item_mark;
|
||||
char *prev_sel_id = mpd_id_of_pos (*selected);
|
||||
char *prev_mark_id = mpd_id_of_pos (*marked);
|
||||
if (prev_sel_id) prev_sel_id = xstrdup (prev_sel_id);
|
||||
if (prev_mark_id) prev_mark_id = xstrdup (prev_mark_id);
|
||||
|
||||
mpd_process_info_data (data);
|
||||
|
||||
const char *sel_id = mpd_id_of_pos (tab->item_selected);
|
||||
const char *mark_id = mpd_id_of_pos (tab->item_mark);
|
||||
const char *sel_id = mpd_id_of_pos (*selected);
|
||||
const char *mark_id = mpd_id_of_pos (*marked);
|
||||
|
||||
if (prev_mark_id && (!mark_id || strcmp (prev_mark_id, mark_id)))
|
||||
tab->item_mark = mpd_find_pos_of_id (prev_mark_id);
|
||||
*marked = mpd_find_pos_of_id (prev_mark_id);
|
||||
if (prev_sel_id && (!sel_id || strcmp (prev_sel_id, sel_id)))
|
||||
{
|
||||
if ((tab->item_selected = mpd_find_pos_of_id (prev_sel_id)) < 0)
|
||||
{
|
||||
tab->item_mark = -1;
|
||||
if (fallback_id)
|
||||
tab->item_selected = mpd_find_pos_of_id (fallback_id);
|
||||
}
|
||||
if ((*selected = mpd_find_pos_of_id (prev_sel_id)) < 0)
|
||||
*marked = -1;
|
||||
app_move_selection (0);
|
||||
}
|
||||
|
||||
free (prev_sel_id);
|
||||
free (prev_mark_id);
|
||||
free (fallback_id);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user