% Tab-EX script for SLirc. irc_log("[Tab-EX] Version 0.6.2 BETA loading..."); % It should be noted that you can do other things, too, besides those really % silly bits. TAB expansion of users, anybody? Dead easy. define tab_expand_user(ch) { % ch will hold the character - it might be a ':', or a ' '. variable name, count, i, j, pfx; if(ch == ':') { % Okay. We only want to do this if this is the first colon, after % no spaces yet in the line. BitchX-like, but on the fly. % We also don't want to expand where there's a conflict. i = index(irc_buffer,' '); if (i) { do_insert_char(':'); return; } % Right. Now we will expand if we can. (name, count) = nick_completions(irc_buffer); do_delete(irc_edit_insert_pos); do_insert_string(name); do_insert_string(": "); return; } % Okay. We have a TAB, so we always expand. % Of course, we have to find out where the heck it began... % find prev space i = rindex(substr(irc_buffer, 1, irc_edit_insert_pos),' '); j = rindex(substr(irc_buffer, 1, irc_edit_insert_pos),','); if (i < j) i = j; % so buffer[i] is 1st char of word if (irc_buffer[i] == cmd_char) { % this is a command-completion i += 2; % advance to 1st char of command pfx = substr(irc_buffer, i, irc_edit_insert_pos - i + 1); (name, count) = cmnd_completions(pfx); %irc_Logf("[Tab-EX] Expanding Command %s=>%s", pfx, name); name = strcat(name," "); }else{ i++; pfx = substr(irc_buffer, i, irc_edit_insert_pos - i + 1); (name, count) = nick_completions(pfx); %irc_Logf("[Tab-EX] Expanding %s=>%s", pfx, name); } if (count) { do_delete(irc_edit_insert_pos - i + 1); do_insert_string(name); } } () = irc_set_keysym(' ', "tab_expand_user", 1); () = irc_set_keysym(':', "tab_expand_user", 1);