From c92afdb61b3c02c87c4f492ec9a5fab0738cdbb0 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Sun, 3 Mar 2013 09:52:30 +0100
Subject: [PATCH] Show hinted element source in status bar.

---
 src/hints.c  |  8 +++++++-
 src/hints.js | 12 +++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/hints.c b/src/hints.c
index 85979ee..5748f06 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -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)) {
diff --git a/src/hints.js b/src/hints.js
index 2f777f2..6852d93 100644
--- a/src/hints.js
+++ b/src/hints.js
@@ -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 : "");
         }
     }
 
-- 
2.20.1