mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
CTCP msgs/replies stops the "event privmsg" or "event notice" signals now
so you don't have to check for them anymore (unless you use signal_add_first()..). /WINDOW MOVE command had some bugs. CTCP reply to some channel didn't display the channel name. Several code cleanups. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@327 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
919abb2c6f
commit
18f3c74d68
19 changed files with 231 additions and 229 deletions
|
|
@ -125,7 +125,7 @@ static void cmd_window_next(void)
|
|||
{
|
||||
int num;
|
||||
|
||||
num = window_refnum_next(active_win->refnum);
|
||||
num = window_refnum_next(active_win->refnum, TRUE);
|
||||
if (num < 1) num = windows_refnum_last();
|
||||
|
||||
window_set_active(window_find_refnum(num));
|
||||
|
|
@ -135,8 +135,8 @@ static void cmd_window_prev(void)
|
|||
{
|
||||
int num;
|
||||
|
||||
num = window_refnum_prev(active_win->refnum);
|
||||
if (num < 1) num = window_refnum_next(0);
|
||||
num = window_refnum_prev(active_win->refnum, TRUE);
|
||||
if (num < 1) num = window_refnum_next(0, TRUE);
|
||||
|
||||
window_set_active(window_find_refnum(num));
|
||||
}
|
||||
|
|
@ -239,9 +239,9 @@ static void cmd_window_move_left(void)
|
|||
{
|
||||
int refnum;
|
||||
|
||||
refnum = window_refnum_prev(active_win->refnum);
|
||||
refnum = window_refnum_prev(active_win->refnum, TRUE);
|
||||
if (refnum != -1) {
|
||||
window_set_refnum(active_win, active_win->refnum-1);
|
||||
window_set_refnum(active_win, refnum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -252,9 +252,9 @@ static void cmd_window_move_right(void)
|
|||
{
|
||||
int refnum;
|
||||
|
||||
refnum = window_refnum_next(active_win->refnum);
|
||||
refnum = window_refnum_next(active_win->refnum, TRUE);
|
||||
if (refnum != -1) {
|
||||
window_set_refnum(active_win, active_win->refnum+1);
|
||||
window_set_refnum(active_win, refnum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ static void cmd_window_move(const char *data, SERVER_REC *server, WI_ITEM_REC *i
|
|||
new_refnum = atoi(data);
|
||||
if (new_refnum > active_win->refnum) {
|
||||
for (;;) {
|
||||
refnum = window_refnum_next(active_win->refnum);
|
||||
refnum = window_refnum_next(active_win->refnum, FALSE);
|
||||
if (refnum == -1 || refnum > new_refnum)
|
||||
break;
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ static void cmd_window_move(const char *data, SERVER_REC *server, WI_ITEM_REC *i
|
|||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
refnum = window_refnum_prev(active_win->refnum);
|
||||
refnum = window_refnum_prev(active_win->refnum, FALSE);
|
||||
if (refnum == -1 || refnum < new_refnum)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,22 @@ void window_item_set_active(WINDOW_REC *window, WI_ITEM_REC *item)
|
|||
}
|
||||
}
|
||||
|
||||
/* Return TRUE if `item' is the active window item in the window.
|
||||
`item' can be NULL. */
|
||||
int window_item_is_active(WI_ITEM_REC *item)
|
||||
{
|
||||
WINDOW_REC *window;
|
||||
|
||||
if (item == NULL)
|
||||
return FALSE;
|
||||
|
||||
window = window_item_window(item);
|
||||
if (window == NULL)
|
||||
return FALSE;
|
||||
|
||||
return window->active == item;
|
||||
}
|
||||
|
||||
void window_item_prev(WINDOW_REC *window)
|
||||
{
|
||||
WI_ITEM_REC *last;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ WINDOW_REC *window_item_window(WI_ITEM_REC *item);
|
|||
void window_item_change_server(WI_ITEM_REC *item, void *server);
|
||||
|
||||
void window_item_set_active(WINDOW_REC *window, WI_ITEM_REC *item);
|
||||
/* Return TRUE if `item' is the active window item in the window.
|
||||
`item' can be NULL. */
|
||||
int window_item_is_active(WI_ITEM_REC *item);
|
||||
|
||||
void window_item_prev(WINDOW_REC *window);
|
||||
void window_item_next(WINDOW_REC *window);
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ WINDOW_REC *window_find_item(WINDOW_REC *window, const char *name)
|
|||
return MODULE_DATA(item);
|
||||
}
|
||||
|
||||
int window_refnum_prev(int refnum)
|
||||
int window_refnum_prev(int refnum, int wrap)
|
||||
{
|
||||
GSList *tmp;
|
||||
int prev, max;
|
||||
|
|
@ -317,14 +317,14 @@ int window_refnum_prev(int refnum)
|
|||
|
||||
if (rec->refnum < refnum && (prev == -1 || rec->refnum > prev))
|
||||
prev = rec->refnum;
|
||||
if (max == -1 || rec->refnum > max)
|
||||
if (wrap && (max == -1 || rec->refnum > max))
|
||||
max = rec->refnum;
|
||||
}
|
||||
|
||||
return prev != -1 ? prev : max;
|
||||
}
|
||||
|
||||
int window_refnum_next(int refnum)
|
||||
int window_refnum_next(int refnum, int wrap)
|
||||
{
|
||||
GSList *tmp;
|
||||
int min, next;
|
||||
|
|
@ -335,7 +335,7 @@ int window_refnum_next(int refnum)
|
|||
|
||||
if (rec->refnum > refnum && (next == -1 || rec->refnum < next))
|
||||
next = rec->refnum;
|
||||
if (min == -1 || rec->refnum < min)
|
||||
if (wrap && (min == -1 || rec->refnum < min))
|
||||
min = rec->refnum;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ WINDOW_REC *window_find_refnum(int refnum);
|
|||
WINDOW_REC *window_find_name(const char *name);
|
||||
WINDOW_REC *window_find_item(WINDOW_REC *window, const char *name);
|
||||
|
||||
int window_refnum_prev(int refnum);
|
||||
int window_refnum_next(int refnum);
|
||||
int window_refnum_prev(int refnum, int wrap);
|
||||
int window_refnum_next(int refnum, int wrap);
|
||||
int windows_refnum_last(void);
|
||||
|
||||
void windows_init(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue