lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev another fix to relative number command suffixes (patch applied


From: Laura Eaves
Subject: lynx-dev another fix to relative number command suffixes (patch applied to dev17 + my previous patch)
Date: Sat, 27 Feb 1999 03:20:31 -0500 (EST)

Sorry about the added patch --
I missed one case when: using 123+g when sitting on an unnumbered
link, such as a text entry field when keypad_mode is not "links and form
fields numbered".

This *should* work now...;)
--le

Index: GridText.c
--- old/GridText.c      Sat Feb 27 02:16:10 1999
+++ src/GridText.c      Sat Feb 27 03:13:18 1999
@@ -3961,6 +3961,8 @@
     TextAnchor *a, *l = 0;
     int scrtop = HText_getTopOfScreen()+1;
     int curline = links[cur].anchor_line_num;
+    int curpos = links[cur].lx;
+    int on_screen = ( curline >= scrtop && curline < (scrtop + display_lines) 
);
     /* curanchor may or may not be the "current link", depending whether it's
      * on the current screen
      */
@@ -3968,16 +3970,13 @@
 
     CTRACE(tfp,"HTGetRelLinkNum(%d,%d,%d) -- HTMainText=%lx\n",
        num,rel,cur,HTMainText);
-    CTRACE(tfp,"  scrtop=%d, curline=%d, curanchor=%d, display_lines=%d\n",
-       scrtop,curline,curanchor,display_lines);
+    CTRACE(tfp,"  scrtop=%d, curline=%d, curanchor=%d, display_lines=%d, %s\n",
+       scrtop,curline,curanchor,display_lines,on_screen?"on_screen":"0");
     if (!HTMainText) return 0;
     if ( rel==0 ) return num;
 
-    if ( curline < scrtop || curline >= (scrtop + display_lines) )
-       curanchor = 0;
-
     /* if cur numbered link is on current page, use it */
-    if ( curanchor ) {
+    if ( on_screen && curanchor ) {
        CTRACE(tfp,"curanchor=%d at line %d on screen\n",curanchor,curline);
        if ( rel == '+' ) return curanchor + num;
        else if ( rel == '-' ) return curanchor - num;
@@ -3995,6 +3994,12 @@
        curanchor = l->number;
     }
     CTRACE(tfp,"  a=%lx, l=%lx, curanchor=%d\n",a,l,curanchor);
+    if ( on_screen ) { /* on screen but not a numbered link */
+       for ( ;  a;  a = a->next ) {
+           if ( a->number ) { l = a; curanchor = l->number; }
+           if ( curline == a->line_num && curpos == a->line_pos ) break;
+       }
+    }
     if ( rel == '+' )
        return curanchor + num;
     else if ( rel == '-' )

reply via email to

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