diff options
author | Timo Sirainen <cras@irssi.org> | 2000-05-09 13:24:13 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-05-09 13:24:13 +0000 |
commit | 00b03e8c0137ac4a73abf7635e38fdf565be1ca3 (patch) | |
tree | 4e1b184498f019f5251a040b4bb678cd17f2b580 /src | |
parent | e33da25e8a31d9871e3378a598565d186b57c0a7 (diff) | |
download | irssi-00b03e8c0137ac4a73abf7635e38fdf565be1ca3.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/windows.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/fe-common/core/windows.c b/src/fe-common/core/windows.c index bcfaa38c..1ee29795 100644 --- a/src/fe-common/core/windows.c +++ b/src/fe-common/core/windows.c @@ -266,33 +266,37 @@ static int windows_refnum_last(void) static int window_refnum_prev(int refnum) { GSList *tmp; - int max; + int prev, max; - max = -1; + max = prev = -1; for (tmp = windows; tmp != NULL; tmp = tmp->next) { WINDOW_REC *rec = tmp->data; if (rec->refnum < refnum && (max == -1 || rec->refnum > max)) 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) { GSList *tmp; - int min; + int min, next; - min = -1; + min = next = -1; for (tmp = windows; tmp != NULL; tmp = tmp->next) { 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; } - return min; + return next != -1 ? next : min; } static void cmd_window(const char *data, void *server, WI_ITEM_REC *item) |