Show hinted element source in status bar.
authorDaniel Carl <danielcarl@gmx.de>
Sun, 3 Mar 2013 08:52:30 +0000 (09:52 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Sun, 3 Mar 2013 08:52:30 +0000 (09:52 +0100)
src/hints.c
src/hints.js

index 85979ee..5748f06 100644 (file)
@@ -56,6 +56,8 @@ void hints_clear(void)
         g_free(value);
         g_free(error);
         g_free(js);
+
+        g_signal_emit_by_name(vp.gui.webview, "hovering-over-link", NULL, NULL);
     }
 }
 
@@ -132,7 +134,11 @@ static void hints_run_script(char* js)
         return;
     }
 
-    if (!strncmp(value, "DONE:", 5)) {
+    if (!strncmp(value, "OVER:", 5)) {
+        g_signal_emit_by_name(
+            vp.gui.webview, "hovering-over-link", NULL, *(value + 5) == '\0' ? NULL : (value + 5)
+        );
+    } else if (!strncmp(value, "DONE:", 5)) {
         hints_observe_input(FALSE);
         vp_set_mode(VP_MODE_NORMAL, TRUE);
     } else if (!strncmp(value, "INSERT:", 7)) {
index 2f777f2..6852d93 100644 (file)
@@ -124,7 +124,7 @@ VimpHints = function Hints(bg, bgf, fg, style) {
         if (hintCount <= 1) {
             return this.fire(1);
         }
-        _focus(1);
+        return _focus(1);
     };
 
     /* set focus to next avaiable hint */
@@ -133,9 +133,9 @@ VimpHints = function Hints(bg, bgf, fg, style) {
         var index = _getHintIdByNumber(curFocusNum);
 
         if (typeof(hints[index + 1]) !== "undefined") {
-            _focus(hints[index + 1].number);
+            return _focus(hints[index + 1].number);
         } else {
-            _focus(hints[0].number);
+            return _focus(hints[0].number);
         }
     };
 
@@ -144,9 +144,9 @@ VimpHints = function Hints(bg, bgf, fg, style) {
     {
         var index = _getHintIdByNumber(curFocusNum);
         if (index !== 0 && typeof(hints[index - 1].number) !== "undefined") {
-            _focus(hints[index - 1].number);
+            return _focus(hints[index - 1].number);
         } else {
-            _focus(hints[hints.length - 1].number);
+            return _focus(hints[hints.length - 1].number);
         }
     };
 
@@ -254,6 +254,8 @@ VimpHints = function Hints(bg, bgf, fg, style) {
             hint.elem.className = hint.elem.className.replace(config.hintClass, config.hintClassFocus);
             hint.elem.style.background = config.eBgf;
             _mouseEvent(hint.elem, "mouseover");
+            var source = _getElemtSource(hint.elem);
+            return "OVER:" + (source ? source : "");
         }
     }