diff options
| -rw-r--r-- | TODO | 7 | ||||
| -rw-r--r-- | doc/editing_keys.txt | 9 | ||||
| -rw-r--r-- | src/complete.c | 48 | ||||
| -rw-r--r-- | src/complete.h | 1 | ||||
| -rw-r--r-- | src/edbox.c | 5 | ||||
| -rw-r--r-- | src/edbox.h | 3 | ||||
| -rw-r--r-- | src/irc.c | 1 |
7 files changed, 57 insertions, 17 deletions
@@ -2,8 +2,8 @@ See also: ideas.txt. FujiChat features, we're almost at parity! -- Nick tab completion. FujiChat's was very lame, make this one - less lame. It can't be perfect due to limited RAM. +- Nick tab completion in channels. FujiChat's was very lame, make + this one less lame. It can't be perfect due to limited RAM. - Configurable ctcp version response. Does it matter? - Keyboard buffer, if possible. Right now we miss the occasional keystroke when typing fast & furious during network I/O. Not @@ -14,6 +14,8 @@ FujiChat features, we're almost at parity! Other stuff: +- Channel tab completion for the [server] screen. +- Polish up the nick tab completion for the [private] screen. - Ping the server periodically, and set a 30-sec timer. If no PONG within 30 sec, assume we're disconnected: close the connection and go into the reconnect loop. @@ -31,7 +33,6 @@ Other stuff: replaced by "you". - Gracefully handle nicks/channels whose lengths are stupid long. At least we shouldn't overflow any buffers. -- Channel tab completion for the [server] screen. - At least one keyboard macro (for ChanServ auth). More would be nice, if we can afford the RAM. - Error numerics should go to the current screen (?). diff --git a/doc/editing_keys.txt b/doc/editing_keys.txt index 59b87bc..b6a2cbb 100644 --- a/doc/editing_keys.txt +++ b/doc/editing_keys.txt @@ -13,6 +13,8 @@ Atari key - insert a ^B (meaning, toggle bold) ^K - kill (delete) to end of buffer. ^F or ctrl-shift-Up - move right by one word. ^B or ctrl-shift-Down - move left by one word. +Tab - in [private], pressing Tab on an empty input box inserts the + last nick that PMed you (outside of a query). Future plans: @@ -21,10 +23,9 @@ Up arrow *in an empty inputbox* - bring up last entered command. Can coexist with regular use of Up for movement. ^Y, Shift-Insert - paste (^K, ^U, ^W fill a paste buffer; need RAM) Ctrl-Insert - toggle insert/typeover (does anyone care about this?) -Tab - tab completion. For [server], complete channels. For [private], -complete nicks that have PM'ed us or that we have PM'ed. For channels, -complete channel nicks (we'll never have enough RAM to have full lists; -search back through screen memory is how it'll work) +Tab - For [server], complete channels. For channels, complete channel +nicks (we'll never have enough RAM to have full lists; search back +through screen memory is how it'll work) Shift-Return: Maybe... send buffer but do not clear it. The glyphs for these will appear as inverse letters, but will actually diff --git a/src/complete.c b/src/complete.c index 0ac00a7..f7ec731 100644 --- a/src/complete.c +++ b/src/complete.c @@ -16,26 +16,41 @@ static char search_pos = 0, in_progress = 0; static char prefix[33]; char comp_pm_nicks[MAX_PM_NICKS][25]; +char comp_pm_chans[MAX_PM_NICKS][25]; char (*list)[25] = comp_pm_nicks; +char (*add_to)[25] = comp_pm_nicks; static char pm_nick_pos = 0; /* insertion point for _add() */ -void comp_add_pm_nick(const char *n) { +static void add_list(const char *n) { int i; for(i = 0; i < 25; i++) - if(strncmp(n, comp_pm_nicks[i], 24) == 0) - return; + if(strncmp(n, add_to[i], 24) == 0) + return; /* we already got this one */ - strncpy(comp_pm_nicks[pm_nick_pos], n, 24); + strncpy(add_to[pm_nick_pos], n, 24); pm_nick_pos++; pm_nick_pos %= MAX_PM_NICKS; } +void comp_add_pm_nick(const char *n) { + add_to = comp_pm_nicks; + add_list(n); +} + +void comp_add_pm_chan(const char *n) { + add_to = comp_pm_chans; + add_list(n); +} + char match(const char *p, const char *q) { int len; - len = strlen(prefix); + while(*p == '#') p++; + while(*q == '#') q++; + + len = strlen(p); if(!len) return 0; while(len--) { @@ -55,27 +70,40 @@ void comp_continue(void) { while(search_pos < MAX_PM_NICKS) { if(match(prefix, list[search_pos])) { edbox_set(list[search_pos]); + edbox_space(); search_pos++; return; } search_pos++; } - edbox_set(prefix); + edbox_set(prefix); /* no space here */ comp_complete_done(); } void comp_start(void) { - if(scr_current != SCR_PRIV) + char *p; + + if(scr_current == SCR_SERVER) { + p = last_chan; + list = comp_pm_chans; + } else if(scr_current == SCR_PRIV) { + p = last_pm_nick; + list = comp_pm_nicks; + } else { + /* channel screens not yet supported */ return; + } - /* just insert the last nick if there's nothing to search for */ + /* just insert the last nick/chan if there's nothing to search for */ if(!edbox_len) { - if(*last_pm_nick) edbox_set(last_pm_nick); + if(*p) { + edbox_set(p); + edbox_space(); + } } else { in_progress = COMP_PM; search_pos = 0; strncpy(prefix, edit_box, 24); - list = comp_pm_nicks; comp_continue(); } } diff --git a/src/complete.h b/src/complete.h index 4b0663b..d344eac 100644 --- a/src/complete.h +++ b/src/complete.h @@ -1,3 +1,4 @@ void comp_complete(void); void comp_complete_done(void); void comp_add_pm_nick(const char *n); +void comp_add_pm_chan(const char *n); diff --git a/src/edbox.c b/src/edbox.c index 5d529d3..2bb1cef 100644 --- a/src/edbox.c +++ b/src/edbox.c @@ -272,6 +272,11 @@ void edbox_keystroke(void) { show_cursor(); } +void edbox_space(void) { + edit_box[edbox_len++] = ' '; + edbox_pos = edbox_len; +} + void edbox_set(char *contents) { edbox_clear(); while(*contents) { diff --git a/src/edbox.h b/src/edbox.h index 4863407..181f17f 100644 --- a/src/edbox.h +++ b/src/edbox.h @@ -28,3 +28,6 @@ extern void (*edbox_callback)(void); /* set edit box contents (clears out whatever was there) */ void edbox_set(char *contents); + +/* append a space to the edit box */ +void edbox_space(void); @@ -498,6 +498,7 @@ void select_screen(void) { s = scr_getbyname(msg_dest); if(!s) { strncpy(last_chan, msg_dest, 32); + comp_add_pm_chan(last_chan); s = SCR_SERVER; } } else { |
