summaryrefslogtreecommitdiff
path: root/src/hints.c
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2013-03-01 16:50:22 +0100
committerDaniel Carl <danielcarl@gmx.de>2013-03-01 17:02:41 +0100
commit63051a62e0a300e949e2bd05f071bb28bd6ae734 (patch)
treeeb7106f3eaf88edad25b2619112212d67c2a8cc9 /src/hints.c
parent443b03780b7fa97aad7b722230ec9708e86e11b5 (diff)
Added hinting mode to open images.
With the ;i or ;I hinting mode images can be hinted end opened.
Diffstat (limited to 'src/hints.c')
-rw-r--r--src/hints.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/hints.c b/src/hints.c
index 09ece4f..97b18f3 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -133,6 +133,7 @@ static void hints_run_script(char* js)
if (!value) {
return;
}
+
if (!strncmp(value, "DONE:", 5)) {
hints_observe_input(FALSE);
vp_set_mode(VP_MODE_NORMAL, TRUE);
@@ -141,21 +142,22 @@ static void hints_run_script(char* js)
vp_set_mode(VP_MODE_INSERT, TRUE);
} else if (!strncmp(value, "DATA:", 5)) {
hints_observe_input(FALSE);
- HintsProcess type = HINTS_GET_PROCESSING(mode);
Arg a = {0};
- switch (type) {
- case HINTS_PROCESS_INPUT:
+ if (mode & HINTS_TYPE_IMAGE) {
+ a.s = (value + 5);
+ a.i = (mode & HINTS_TARGET_BLANK) ? VP_TARGET_NEW : VP_TARGET_CURRENT;
+ command_open(&a);
+ } else {
+ HintsProcess type = HINTS_GET_PROCESSING(mode);
+ if (type == HINTS_PROCESS_INPUT) {
a.s = g_strconcat((mode & HINTS_TARGET_BLANK) ? ":tabopen " : ":open ", (value + 5), NULL);
command_input(&a);
g_free(a.s);
- break;
-
- case HINTS_PROCESS_YANK:
+ } else if (type == HINTS_PROCESS_YANK) {
a.i = COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY;
- a.s = g_strdup((value + 5));
+ a.s = (value + 5);
command_yank(&a);
- g_free(a.s);
- break;
+ }
}
}
g_free(value);