On Mon, Feb 01, 2016 at 08:30:03AM -0600, martholomew wrote: > On Sun, Jan 24, 2016 at 02:03:28PM +0100, Witold Filipczyk wrote: > > On Tue, Jan 12, 2016 at 01:35:29PM -0600, Martin Miller wrote: > > > Hi > > > > > > Let me start by saying that it was a bit tough to subscribe to this list > > > as the > > > information on elinks.cz is out of date, and the link to the archive > > > makes it > > > look like there has been no ML activity since 2014. > > > > > > I'm attaching a patch that allows users to label links not only with > > > numbers, > > > but with characters from a specified set. Some may be familiar with this > > > feature > > > from vimperator (though it's not the default) or similar keyboard driven > > > GUI > > > browsers. > > > > > > Using non-numeric link labels means that a key must be bound to bring up > > > the > > > link selection dialog, whereas using numbers you can just start typing > > > the link > > > number directly. This adds one keystroke, but alpha link labels keep your > > > hands > > > near the home row, which I personally find preferable. > > > > > > The patch essentially lets the user set the base for link numbering and > > > the tokens used for the numbers. I made the default so that there is no > > > change, > > > i.e. "0123456789". For my usage, I have set > > > "gfdsahjkl;GFDSAHJKLtrewqyuiopvcxznm" > > > > > > To bring up the link selection dialog, the user can bind "link-dialog": > > > > > > bind "main" "f" = "link-dialog" > > > > > > I kept the functionality where typing a number will also bring up the > > > dialog. > > > The difference is that using a number will enter that number into the > > > dialog, > > > whereas using link-dialog opens with an empty text box. > > > > > > I have packaged a slightly earlier version as an rpm: > > > ftp://witsquash.com/rpms/elinks-0.12-0.48.pre6.fc23.x86_64.rpm > > > > > > Add this to your elinks.conf: > > > > > > bind "main" "f" = "link-dialog" > > > set document.browse.links.number_links_with_key = > > > "gfdsahjkl;GFDSAHJKLtrewqyuiopvcxznm" > > > > > > The attached patch was written against 0.12-pre6. I modified dialog > > > behavior to > > > agree with the above paragraph, and changed the config variable to > > > something > > > shorter, so use this in your elinks.conf: > > > > > > bind "main" "f" = "link-dialog" > > > set document.browse.links.label_key = > > > "gfdsahjkl;GFDSAHJKLtrewqyuiopvcxznm" > > > > > > Can we add this feature into elinks? Thanks and enjoy. > > > > Interesting. Some comments: > > Please, use tabs for indentations. > > > > > +/* > > > + * Converts a number in base 10 to a string in another base whose > > > symbols are > > > + * represented by key. I the trivial case, key="0123456789". A more > > > homerow > > > + * friendly key="gfdsahjkl;trewqyuiopvcxznm". Returns the length of > > > link_sym. > > > + */ > > > +static int > > > +dec2qwerty(int num, char *link_sym, const char *key) > > > +{ > > > + int base = strlen(key); > > > + > > > + int newlen = 1; > > > + while (pow(base, newlen) < num) ++newlen; > > > > If strlen(key) is 0 or 1, this loop never ends. > > > > One issue is that pow requires -lm and <math.h>. > > -lm is not always in LIBS. > > I will fix this when I get the chance. I'll have to look at the code to see > what makes the most sense, but I think I'll use "0123456789" if strlen returns > 0 or 1. > > Removing pow and replacing it with some sort of *= shouldn't be too much > trouble. > > I've been running the patch for a couple weeks so far, and it works great, but > I did realize recently that the References in an elinks dump do not print the > new link symbols, so I'll add that in with the new patch as well.
I applied the patch to 0.13 (master) branch, so please prepare patch based on that branch. -- http://lists.linuxfromscratch.org/listinfo/elinks-dev Unsubscribe: See the above information page