edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Tyler Spivey <tspivey@pcdesk.net>
To: edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] bookmarks
Date: Sat, 22 Nov 2014 23:05:48 -0800	[thread overview]
Message-ID: <5471874C.4020603@pcdesk.net> (raw)

I propose the following change.
If using the A command on a page (not on a link),
and the page has a title, use that as the auto-suggested bookmark name.

Old: ref=s9_dnav_bw_ir12_s
new: Amazon.com: Science Fiction - Science Fiction & Fantasy: Kindle Store


I don't have git's email sender setup, so I'll just paste a patch here.
I did notice one bug I do'nt know how to fix, though it might not matter much. If a link contains
< > or &, they're not turned into &lt; &gt; and &amp;. This also applies to the title.
I'm not very familiar with the code, but this seems to work. I'll see how it works when I bookmark more.

>From 08d9dbd675aa77146c8f1f072a64929de8639a57 Mon Sep 17 00:00:00 2001
From: Tyler Spivey <tspivey@pcdesk.net>
Date: Sat, 22 Nov 2014 22:57:43 -0800
Subject: [PATCH] Make A suggest title if it can

Make the A command suggest the page title if it has one,
if we're not on a link.
---
 src/buffers.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/buffers.c b/src/buffers.c
index 540cb99..4799838 100644
--- a/src/buffers.c
+++ b/src/buffers.c
@@ -3479,7 +3479,9 @@ static char *showLinks(void)
 		stringAndString(&a, &a_l, "<a href=");
 		stringAndString(&a, &a_l, h);
 		stringAndString(&a, &a_l, ">\n");
-		s = (char *)getDataURL(h);
+		s = cw->ft;
+		if (!s || !*s)
+			s = (char *)getDataURL(h);
 		if (!s || !*s)
 			s = h;
 		t = s + strcspn(s, "\1?#");
-- 
1.9.1


             reply	other threads:[~2014-11-23  7:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-23  7:05 Tyler Spivey [this message]
2014-11-23 11:43 Karl Dahlke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5471874C.4020603@pcdesk.net \
    --to=tspivey@pcdesk.net \
    --cc=edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).