From e05376aefc6b342859e8cddf9eca647dc61c3336 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 18 Feb 2026 13:26:59 -0500 Subject: More work... --- src/cmd.c | 2 +- src/edbox.c | 1 + src/irc.c | 12 ++++++------ src/screen.c | 34 +++++++++++++++++++++++----------- src/screen.h | 8 +++++++- 5 files changed, 38 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/cmd.c b/src/cmd.c index 1eccdf5..89d8c4c 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -17,7 +17,7 @@ void cmd_command(const char *cmd) { txbuf_send_str(cmd + 1); else if(channel[0]) cmd_chan_text(cmd); - else scr_print(SCR_CURR, "*** You are not on a channel\n"); + else scr_print_current("*** You are not on a channel\n"); } void cmd_execute(void) { diff --git a/src/edbox.c b/src/edbox.c index b64ef11..4492308 100644 --- a/src/edbox.c +++ b/src/edbox.c @@ -98,6 +98,7 @@ static void special_keystroke(char c) { static void backspace(void) { if(!edbox_pos) return; + hide_cursor(); edit_box[--edbox_pos] = 0; edbox_show(); } diff --git a/src/irc.c b/src/irc.c index c82baad..5be1c85 100644 --- a/src/irc.c +++ b/src/irc.c @@ -271,10 +271,10 @@ static void irc_parse(void) { void print_errnum(void) { extern unsigned char err; char tmp[10]; - scr_print(SCR_CURR, "Error #"); + scr_print_current("Error #"); itoa(err, tmp, 10); - scr_print(SCR_CURR, tmp); - scr_print(SCR_CURR, ", press any key...\n"); + scr_print_current(tmp); + scr_print_current(", press any key...\n"); } #ifdef __ATARI__ @@ -284,7 +284,7 @@ int irc_read(void) { err = nstatus(url); if(err == 136) { - scr_print(SCR_CURR, "Disconnected, press any key...\n"); + scr_print_current("Disconnected, press any key...\n"); cgetc(); return 0; } else if(err != 1) { @@ -301,7 +301,7 @@ int irc_read(void) { if(bw > 0) { err = nread(url, rx_buf, bw); if(err != 1) { - scr_print(SCR_CURR, "READ ERROR: "); + scr_print_current("READ ERROR: "); print_errnum(); return 0; } @@ -337,7 +337,7 @@ static void start_keystroke(void) { i = cgetc(); if(i >= '1' && i <= '7') { s = i - '1'; - if(scr_active[s] != SCR_UNUSED) + if(scr_status[s] != SCR_UNUSED) scr_display(s); } } diff --git a/src/screen.c b/src/screen.c index 7f34331..3e3f5df 100644 --- a/src/screen.c +++ b/src/screen.c @@ -6,11 +6,14 @@ #define SDLST ((u16 *)0x0230) -char scr_active[MAX_SCREENS]; +char scr_status[MAX_SCREENS]; /* the screen that's currently displaying */ char scr_current; +/* the screen that's currently being written to */ +char scr_active; + static char scr_names[7][32]; static char scr_topics[7][40]; @@ -43,12 +46,12 @@ void scr_init(void) { for(i = 0; i < MAX_SCREENS; i++) { scr_clear(i); - scr_active[i] = SCR_UNUSED; + scr_status[i] = SCR_UNUSED; } strcpy(scr_names[0], "[server]"); strcpy(scr_names[1], "[private]"); - scr_active[0] = scr_active[1] = SCR_INACTIVE; + scr_status[0] = scr_status[1] = SCR_INACTIVE; OS.sdmctl = old_dma; @@ -59,9 +62,9 @@ char scr_create(const char *name, char display) { int i; for(i = 0; i < MAX_SCREENS; i++) { - if(scr_active[i] == SCR_UNUSED) { + if(scr_status[i] == SCR_UNUSED) { strcpy(scr_names[i], name); - scr_active[i] = SCR_INACTIVE; + scr_status[i] = SCR_INACTIVE; scr_topics[i][0] = '\0'; if(display) scr_display(i); @@ -71,7 +74,7 @@ char scr_create(const char *name, char display) { } } - // scr_print(SCR_CURR, "Can't create window (all in use)\n"); + // scr_print_current("Can't create window (all in use)\n"); return 0xff; } @@ -80,7 +83,7 @@ void scr_destroy(char s) { if(s < 2 || s >= MAX_SCREENS) return; - scr_active[s] = SCR_UNUSED; + scr_status[s] = SCR_UNUSED; if(scr_current == s) scr_display(0); } @@ -94,11 +97,11 @@ void scr_display(char s) { return; /* leave this out, for testing - if(scr_active[s] == SCR_UNUSED) + if(scr_status[s] == SCR_UNUSED) return; */ - scr_active[s] = SCR_INACTIVE; + scr_status[s] = SCR_INACTIVE; scr_current = s; scr_waitvcount(112); @@ -118,7 +121,7 @@ void scr_show_status(char s) { p = status_box + 33; for(i = 0; i < MAX_SCREENS; i++) { - switch(scr_active[i]) { + switch(scr_status[i]) { case SCR_ACTIVE: sc = 128 | ('1' + i); break; case SCR_INACTIVE: @@ -214,9 +217,18 @@ void scr_print(char s, const char *text) { scr_activate(s); } +void scr_print_current(const char *text) { + scr_print(scr_current, text); +} + +void scr_print_active(const char *text) { + scr_print(scr_active, text); +} + void scr_activate(char s) { if(s != scr_current) { - scr_active[s] = SCR_ACTIVE; + scr_status[s] = SCR_ACTIVE; scr_show_status(scr_current); } + scr_active = s; } diff --git a/src/screen.h b/src/screen.h index 849133c..51bf090 100644 --- a/src/screen.h +++ b/src/screen.h @@ -22,7 +22,7 @@ extern char scr_current; never active. any screen that's not visible that's had anything written to it gets marked active. switching the display to an active screen clears its active flag. */ -extern char scr_active[MAX_SCREENS]; +extern char scr_status[MAX_SCREENS]; /* call before using any of the other functions. sets up the display list, clears all screen memory, selects screen 0 @@ -72,6 +72,12 @@ void scr_putc(char s, char c); if it's not, it gets marked as active. */ void scr_print(char s, const char *text); +/* print to active screen (set with scr_activate())*/ +void scr_print_active(const char *text); + +/* print to the currently-displayed screen */ +void scr_print_current(const char *text); + /* set a screen's status to active, if it's not the currently-displayed one. scr_print() sets it already, but anything that uses scr_putc() will have to call this. */ -- cgit v1.2.3