From: Daniel Carl Date: Sun, 3 Mar 2013 08:52:30 +0000 (+0100) Subject: Show hinted element source in status bar. X-Git-Url: https://git.owens.tech/git.owens.tech/git.owens.tech/git?a=commitdiff_plain;h=c92afdb61b3c02c87c4f492ec9a5fab0738cdbb0;p=vimb.git Show hinted element source in status bar. --- 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 : ""); } }