mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
window next in last window jumps to first window
window prev in first window jumps to last window git-svn-id: http://svn.irssi.org/repos/irssi/trunk@204 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
e33da25e8a
commit
00b03e8c01
@ -266,33 +266,37 @@ static int windows_refnum_last(void)
|
|||||||
static int window_refnum_prev(int refnum)
|
static int window_refnum_prev(int refnum)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
int max;
|
int prev, max;
|
||||||
|
|
||||||
max = -1;
|
max = prev = -1;
|
||||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||||
WINDOW_REC *rec = tmp->data;
|
WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (rec->refnum < refnum && (max == -1 || rec->refnum > max))
|
if (rec->refnum < refnum && (max == -1 || rec->refnum > max))
|
||||||
max = rec->refnum;
|
max = rec->refnum;
|
||||||
|
if (max == -1 || rec->refnum > max)
|
||||||
|
max = rec->refnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return max;
|
return prev != -1 ? prev : max;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_refnum_next(int refnum)
|
static int window_refnum_next(int refnum)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
int min;
|
int min, next;
|
||||||
|
|
||||||
min = -1;
|
min = next = -1;
|
||||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||||
WINDOW_REC *rec = tmp->data;
|
WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (rec->refnum > refnum && (min == -1 || rec->refnum < min))
|
if (rec->refnum > refnum && (next == -1 || rec->refnum < next))
|
||||||
|
next = rec->refnum;
|
||||||
|
if (min == -1 || rec->refnum < min)
|
||||||
min = rec->refnum;
|
min = rec->refnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return min;
|
return next != -1 ? next : min;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_window(const char *data, void *server, WI_ITEM_REC *item)
|
static void cmd_window(const char *data, void *server, WI_ITEM_REC *item)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user