1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Added /COMPLETION -delete and some fixes.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2799 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-05-16 06:21:21 +00:00 committed by cras
parent 622d239deb
commit e177b3fe94
3 changed files with 18 additions and 5 deletions

View File

@ -777,16 +777,27 @@ static void cmd_completion(const char *data)
return;
}
if (*key != '\0' && *value != '\0') {
if (g_hash_table_lookup(optlist, "delete") != NULL && *key != '\0') {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_COMPLETION_REMOVED, key);
iconfig_set_str("completions", key, NULL);
signal_emit("completion removed", 1, key);
} else if (*key != '\0' && *value != '\0') {
int automatic = g_hash_table_lookup(optlist, "auto") != NULL;
node = config_node_section(node, key, NODE_TYPE_BLOCK);
iconfig_node_set_str(node, "value", value);
iconfig_node_set_bool(node, "auto", automatic);
if (automatic)
iconfig_node_set_bool(node, "auto", TRUE);
else
iconfig_node_set_str(node, "auto", NULL);
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
TXT_COMPLETION_LINE,
key, value, automatic ? "yes" : "no");
signal_emit("completion added", 1, key);
} else {
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
TXT_COMPLETION_HEADER);
@ -832,7 +843,7 @@ void completion_init(void)
signal_add("complete command rawlog save", (SIGNAL_FUNC) sig_complete_filename);
signal_add("complete command help", (SIGNAL_FUNC) sig_complete_command);
command_set_options("completion", "auto");
command_set_options("completion", "auto delete");
}
void completion_deinit(void)

View File

@ -264,8 +264,9 @@ FORMAT_REC fecommon_core_formats[] = {
{ "translation_not_found", "Error opening translation table file $0: $1", 2, { 0, 0 } },
{ "translation_file_error", "Error parsing translation table file $0", 1, { 0 } },
{ "no_completions", "There's no completions", 0 },
{ "completion_header", "Key Value Auto", 0 },
{ "completion_line", "$[10]0 $[!40]1 $2", 3, { 0, 0, 0 } },
{ "completion_removed", "Removed completion $0", 1, { 0 } },
{ "completion_header", "%#Key Value Auto", 0 },
{ "completion_line", "%#$[10]0 $[!40]1 $2", 3, { 0, 0, 0 } },
{ "completion_footer", "", 0 },
{ NULL, NULL, 0 }

View File

@ -230,6 +230,7 @@ enum {
TXT_TRANSLATION_NOT_FOUND,
TXT_TRANSLATION_FILE_ERROR,
TXT_NO_COMPLETIONS,
TXT_COMPLETION_REMOVED,
TXT_COMPLETION_HEADER,
TXT_COMPLETION_LINE,
TXT_COMPLETION_FOOTER