From 7f4b86763ca2f340ff9e1cae9a139f91fe349149 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 14 Mar 2026 04:19:26 -0400 Subject: show hilited screens in red. --- src/irc.c | 33 +++++++++++++++++++++++++-------- src/screen.c | 14 ++++++++++---- src/screen.h | 3 +++ 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/irc.c b/src/irc.c index 5e49d73..2dc57e3 100644 --- a/src/irc.c +++ b/src/irc.c @@ -72,7 +72,10 @@ static void hilite_bold(void) { } static void do_chan_nick(void) { - if(hilite) bell(); + if(hilite) { + bell(); + scr_hilite_active(); + } hilite_bold(); scr_print_active("<"); hilite_bold(); @@ -93,6 +96,7 @@ static void do_priv_nick(void) { scr_print_active("*"); scr_print_active(msg_src); scr_print_active("* "); + scr_hilite_active(); bell(); } } @@ -224,10 +228,11 @@ static void do_privmsg(void) { return; } - if(*msg_dest == '#') + if(*msg_dest == '#') { do_chan_nick(); - else + } else { do_priv_nick(); + } scr_print_active(msg_text); scr_eol_active(); @@ -761,16 +766,28 @@ static char cur_is_query(void) { } */ -void switch_to_active() { +char find_scr(int status) { char i; for(i = 0; i < MAX_SCREENS; i++) { - if(scr_status[i] == SCR_ACTIVE) { - scr_prev = scr_current; - scr_display(i); - return; + if(scr_status[i] == status) { + return i; } } + return 0xff; +} + +void switch_to_active() { + char i; + + i = find_scr(SCR_HILITE); + if(i == 0xff) + i = find_scr(SCR_ACTIVE); + if(i != 0xff) { + scr_prev = scr_current; + scr_display(i); + } + } void list_screens(void) { diff --git a/src/screen.c b/src/screen.c index f10ac87..e71b5e8 100644 --- a/src/screen.c +++ b/src/screen.c @@ -147,9 +147,9 @@ void scr_show_status(char s) { case SCR_ACTIVE: /* color1 */ sc |= 0x40; break; -// case SCR_HILITE: /* color3 */ -// sc |= 0xc0; -// break; + case SCR_HILITE: /* color3 */ + sc |= 0xc0; + break; default: sc = '.'; } @@ -165,6 +165,12 @@ void scr_show_status(char s) { } } +void scr_hilite_active(void) { + if(scr_active == scr_current) return; + scr_status[scr_active] = SCR_HILITE; + scr_show_status(scr_current); +} + void scr_refresh(void) { scr_display(scr_current); } @@ -278,7 +284,7 @@ void scr_print_priv(const char *text) { void scr_activate(char s) { if(s != scr_current) { - scr_status[s] = SCR_ACTIVE; + if(scr_status[s] != SCR_HILITE) scr_status[s] = SCR_ACTIVE; scr_show_status(scr_current); } scr_active = s; diff --git a/src/screen.h b/src/screen.h index cbe8615..787310d 100644 --- a/src/screen.h +++ b/src/screen.h @@ -8,6 +8,7 @@ #define SCR_UNUSED 0 #define SCR_INACTIVE 1 #define SCR_ACTIVE 2 +#define SCR_HILITE 3 #define SCR_SERVER 0 #define SCR_PRIV 1 @@ -99,6 +100,8 @@ void scr_print_priv(const char *text); will have to call this. */ void scr_activate(char s); +void scr_hilite_active(void); + char *scr_get_cur_name(void); /* XXX: this really should be in a utils.c or common.c... */ -- cgit v1.2.3