Probably not everyone will agree with this patch or whether it is
necessary, so consider this as much of an RFC as an actual patch. :)
I found it a bit irritating that hints are numbered differently in
open mode as compared with yank or show modes, so this patch fixes
that issue. For example, you may want to follow a link but you don't
trust the source, so you do ";l" and find that it's hint number 72.
You see the link and decide it's safe, so you do "f", but now due to
the different modes you have to scan through the page again and find
that the link has changed to 103. This is somewhat confusing, as you'd
expect to be able to just do ";l72", "f72". This issue is especially
noticeable on sites like reddit, which contain a lot of both links and
clickable javascript.
This is obviously a bit of a nitpick, but it seems much more intuitive
to me. It does introduce the issue of possibly yanking or showing a
link that is undefined, which I handled by just silently ignoring.
Feel free to discuss and keep the current behavior if I'm too picky.
:)
Regards,
Morgan
From a8d29ecddd40fcf1e5dd061ac8ecbe9ee9931d69 Mon Sep 17 00:00:00 2001
From: Morgan Howe <[email protected]>
Date: Thu, 22 Jan 2015 16:35:28 +0800
Subject: [PATCH] Preserve hint numbering across f, l, and y hint modes.
This patch will make sure that hints are numbered the same in show_link
and yank as they are in open mode. Performing a show or yank on an
invalid link will be ignored.
---
hinting.js | 2 ++
main.c | 14 ++++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/hinting.js b/hinting.js
index 7814a1f..bc0681d 100644
--- a/hinting.js
+++ b/hinting.js
@@ -442,6 +442,8 @@ function Hints() {
switch (mode) {
case "f":
case "F":
+ case "y":
+ case "l":
if (text === "") {
expr = "//*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @role='link' or @href] | //input[not(@type='hidden')] | //a[href] | //area | //textarea | //button | //select";
} else {
diff --git a/main.c b/main.c
index 7bd0ad9..fc780dc 100644
--- a/main.c
+++ b/main.c
@@ -457,12 +457,14 @@ set_widget_font_and_color(GtkWidget *widget, const char *font_str, const char *b
static void
show_link(const char *link) {
- char *markup;
+ if (strcmp(link, "undefined")) {
+ char *markup;
- markup = g_markup_printf_escaped("<span font=\"%s\">Link: %s</span>", statusfont, link);
- gtk_label_set_markup(GTK_LABEL(client.gui.status_url), markup);
- strncpy(client.state.rememberedURI, link, BUF_SIZE);
- g_free(markup);
+ markup = g_markup_printf_escaped("<span font=\"%s\">Link: %s</span>", statusfont, link);
+ gtk_label_set_markup(GTK_LABEL(client.gui.status_url), markup);
+ strncpy(client.state.rememberedURI, link, BUF_SIZE);
+ g_free(markup);
+ }
}
void
@@ -1347,7 +1349,7 @@ yank(const Arg *arg) {
} else {
url = arg->s;
}
- if (!url)
+ if (!url || !strcmp(url, "undefined"))
return TRUE;
echo_message(Info, "Yanked %s", url);
--
2.2.1
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Vimprobable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vimprobable-users