~ft/zuke

73d9cb94c73a8c264cb3f6834828985bd15556d5 — Sigrid Haflínudóttir a month ago eac2af2
search: fix cycle when on first/last element in the playlist
1 files changed, 11 insertions(+), 8 deletions(-)

M zuke.c
M zuke.c => zuke.c +11 -8
@@ 763,7 763,7 @@ search(char d)
		return;

	cycle = 1;
	for(i = pcur+inc; i >= 0 && i < plnum; i += inc){
	for(i = pcur+inc; i >= 0 && i < plnum;){
		m = getmeta(i);
		for(a = 0; a < m->numartist; a++){
			if(cistrstr(m->artist[a], buf) != nil)


@@ 775,18 775,21 @@ search(char d)
			break;
		if(cistrstr(m->path, buf) != nil)
			break;
		if(cycle && i+inc == -1){
			cycle = 0;
			i = plnum;
		}else if(cycle && i+inc == plnum){
			cycle = 0;
			i = -1;
		}
onemore:
		i += inc;
	}
	if(i >= 0 && i < plnum){
		pcur = i;
		recenter();
		redraw(1);
	}else if(cycle && i+inc < 0){
		cycle = 0;
		i = plnum;
		goto onemore;
	}else if(cycle && i+inc >= plnum){
		cycle = 0;
		i = -1;
		goto onemore;
	}
}