summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-05-16 06:21:21 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-05-16 06:21:21 +0000
commite177b3fe94d4224d2a501029012c428eef3ac4c7 (patch)
tree2c7658d88a24c26a842a9a9884583c7d2d451803
parent622d239deb0c7abfe598d244343bb26e570d4d63 (diff)
downloadirssi-e177b3fe94d4224d2a501029012c428eef3ac4c7.zip
Added /COMPLETION -delete and some fixes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2799 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/core/completion.c17
-rw-r--r--src/fe-common/core/module-formats.c5
-rw-r--r--src/fe-common/core/module-formats.h1
3 files changed, 18 insertions, 5 deletions
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index 7c5bbcd9..2298b937 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -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)
diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c
index 67973072..3d577546 100644
--- a/src/fe-common/core/module-formats.c
+++ b/src/fe-common/core/module-formats.c
@@ -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 }
diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h
index 8c7a9870..016f4d29 100644
--- a/src/fe-common/core/module-formats.h
+++ b/src/fe-common/core/module-formats.h
@@ -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