summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-17 16:10:29 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-17 16:10:29 +0000
commita9a0f4fd64eeb33ca51dc1d3e9f425a8b468eeca (patch)
tree40626d8ba836985197c7aeb08f5d3fc2a40e580e /src/fe-common
parent0762fbc945384aec4e5cb95626e3b55a89738766 (diff)
downloadirssi-a9a0f4fd64eeb33ca51dc1d3e9f425a8b468eeca.zip
Added file name completion for commands /CAT, /RUN, /SAVE, /REHASH and
/RAWLOG OPEN/SAVE. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@363 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/completion.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index 77696826..010a2d4c 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -403,12 +403,35 @@ static void sig_complete_word(GList **list, WINDOW_REC *window,
}
}
+/* first argument of command is file name - complete it */
+static void sig_complete_filename(GList **list, WINDOW_REC *window,
+ const char *word, const char *line, int *want_space)
+{
+ g_return_if_fail(list != NULL);
+ g_return_if_fail(word != NULL);
+ g_return_if_fail(line != NULL);
+
+ if (*line != '\0') return;
+
+ *list = filename_complete(word);
+ if (*list != NULL) {
+ *want_space = FALSE;
+ signal_stop();
+ }
+}
+
void completion_init(void)
{
complist = NULL;
last_linestart = NULL;
signal_add("complete word", (SIGNAL_FUNC) sig_complete_word);
+ signal_add("complete command cat", (SIGNAL_FUNC) sig_complete_filename);
+ signal_add("complete command run", (SIGNAL_FUNC) sig_complete_filename);
+ signal_add("complete command save", (SIGNAL_FUNC) sig_complete_filename);
+ signal_add("complete command rehash", (SIGNAL_FUNC) sig_complete_filename);
+ signal_add("complete command rawlog open", (SIGNAL_FUNC) sig_complete_filename);
+ signal_add("complete command rawlog save", (SIGNAL_FUNC) sig_complete_filename);
}
void completion_deinit(void)
@@ -416,4 +439,10 @@ void completion_deinit(void)
free_completions();
signal_remove("complete word", (SIGNAL_FUNC) sig_complete_word);
+ signal_remove("complete command cat", (SIGNAL_FUNC) sig_complete_filename);
+ signal_remove("complete command run", (SIGNAL_FUNC) sig_complete_filename);
+ signal_remove("complete command save", (SIGNAL_FUNC) sig_complete_filename);
+ signal_remove("complete command rehash", (SIGNAL_FUNC) sig_complete_filename);
+ signal_remove("complete command rawlog open", (SIGNAL_FUNC) sig_complete_filename);
+ signal_remove("complete command rawlog save", (SIGNAL_FUNC) sig_complete_filename);
}