diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-03-18 03:07:00 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-03-18 03:07:00 -0400 |
| commit | 0b9b047188bc61043095839d2af0e414eced4688 (patch) | |
| tree | 1060687339b0847eaee1d15ceb14d5777f61cc63 | |
| parent | 2ae01c91c28ea8ce05266d1e121438af140b870f (diff) | |
| download | fujinet-chat-0b9b047188bc61043095839d2af0e414eced4688.tar.gz | |
Tab completion getting better. Add a : after the nick, in channel screens.
| -rw-r--r-- | src/complete.c | 8 | ||||
| -rw-r--r-- | src/edbox.c | 8 | ||||
| -rw-r--r-- | src/edbox.h | 3 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/complete.c b/src/complete.c index d168398..108bc90 100644 --- a/src/complete.c +++ b/src/complete.c @@ -12,7 +12,7 @@ #define MAX_PM_NICKS 10 -static char search_pos = 0, in_progress = 0; +static char search_pos = 0, in_progress = 0, want_colon = 0; static char prefix[33]; char comp_pm_nicks[MAX_PM_NICKS][25]; @@ -125,6 +125,7 @@ void comp_continue(void) { while(search_pos < MAX_PM_NICKS) { if(match(prefix, list[search_pos])) { edbox_set(list[search_pos]); + if(want_colon) edbox_addchr(':'); edbox_space(); search_pos++; return; @@ -138,6 +139,7 @@ void comp_continue(void) { void comp_start(void) { char *p; + want_colon = 0; if(scr_current == SCR_SERVER) { p = last_chan; list = comp_pm_chans; @@ -145,15 +147,17 @@ void comp_start(void) { p = last_pm_nick; list = comp_pm_nicks; } else if(scr_names[scr_current][0] == '#') { - p = last_pm_nick; // XXX: there should be a last_hilite_nick! find_chan_nicks(); list = comp_chan_nicks; + if(pm_nick_pos) p = comp_chan_nicks[pm_nick_pos - 1]; + want_colon = 1; } /* just insert the last nick/chan if there's nothing to search for */ if(!edbox_len) { if(*p) { edbox_set(p); + if(want_colon) edbox_addchr(':'); edbox_space(); } } else { diff --git a/src/edbox.c b/src/edbox.c index 2bb1cef..b043233 100644 --- a/src/edbox.c +++ b/src/edbox.c @@ -272,11 +272,15 @@ void edbox_keystroke(void) { show_cursor(); } -void edbox_space(void) { - edit_box[edbox_len++] = ' '; +void edbox_addchr(char c) { + edit_box[edbox_len++] = c; edbox_pos = edbox_len; } +void edbox_space(void) { + edbox_addchr(' '); +} + void edbox_set(char *contents) { edbox_clear(); while(*contents) { diff --git a/src/edbox.h b/src/edbox.h index 181f17f..14dad03 100644 --- a/src/edbox.h +++ b/src/edbox.h @@ -30,4 +30,7 @@ extern void (*edbox_callback)(void); void edbox_set(char *contents); /* append a space to the edit box */ +void edbox_addchr(char c); + +/* append a space to the edit box */ void edbox_space(void); |
