lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH] Better up/down keyboard navigation


From: Ilya Zakharevich
Subject: lynx-dev [PATCH] Better up/down keyboard navigation
Date: Sun, 6 Dec 1998 01:18:21 -0500 (EST)

This makes up-link and down-link to do what is advertized instead of
moving up-and-end-of-line and down-and-beg-of-line.

Enjoy,
Ilya

--- ./src/LYMainLoop.c.pre      Sat Dec  5 20:31:12 1998
+++ ./src/LYMainLoop.c  Sun Dec  6 01:10:48 1998
@@ -2408,7 +2408,27 @@ new_cmd:  /*
                int newlink = -1;
                for (i = curdoc.link; i >= 0; i--) {
                    if (links[i].ly < links[curdoc.link].ly) {
-                       newlink = i;
+                       int cy = links[i].ly, best, dist = 1000000;
+                       int ox = links[curdoc.link].lx;
+
+                       if (links[curdoc.link].hightext) 
+                           ox += strlen(links[curdoc.link].hightext)/2;
+
+                       while (i >= 0 && cy == links[i].ly) {
+                           int cx = links[i].lx;
+                           
+                           if (links[i].hightext) 
+                               cx += strlen(links[i].hightext)/2;
+                           cx -= ox;
+                           if (cx < 0)
+                               cx = -cx;
+                           if (cx < dist) {
+                               dist = cx;
+                               best = i;
+                           }
+                           i--;
+                       }
+                       newlink = best;
                        break;
                    }
                }
@@ -2463,7 +2483,27 @@ new_cmd:  /*
                int newlink = -1;
                for (i = curdoc.link; i < nlinks; i++)
                   if (links[i].ly > links[curdoc.link].ly) {
-                       newlink = i;
+                       int cy = links[i].ly, best, dist = 1000000;
+                       int ox = links[curdoc.link].lx;
+
+                       if (links[curdoc.link].hightext) 
+                           ox += strlen(links[curdoc.link].hightext)/2;
+
+                       while (i < nlinks && cy == links[i].ly) {
+                           int cx = links[i].lx;
+                           
+                           if (links[i].hightext) 
+                               cx += strlen(links[i].hightext)/2;
+                           cx -= ox;
+                           if (cx < 0)
+                               cx = -cx;
+                           if (cx < dist) {
+                               dist = cx;
+                               best = i;
+                           }
+                           i++;
+                       }
+                       newlink = best;
                        break;
                   }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]