texinfo-commits
[Top][All Lists]
Advanced

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

[5969] handle multiple references on one line differently


From: Gavin D. Smith
Subject: [5969] handle multiple references on one line differently
Date: Tue, 16 Dec 2014 20:00:09 +0000

Revision: 5969
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5969
Author:   gavin
Date:     2014-12-16 20:00:03 +0000 (Tue, 16 Dec 2014)
Log Message:
-----------
handle multiple references on one line differently

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-12-16 19:06:31 UTC (rev 5968)
+++ trunk/ChangeLog     2014-12-16 20:00:03 UTC (rev 5969)
@@ -2,6 +2,9 @@
 
        * info/indices.c (info_indices_of_file_buffer): Case insensitive 
        search for nodes with "index" in their names.
+       
+       * info/session.c (info_menu_ref_item): If multiple references in 
+       a line pick the right one.
 
 2014-12-14  Karl Berry  <address@hidden>
 

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-12-16 19:06:31 UTC (rev 5968)
+++ trunk/info/session.c        2014-12-16 20:00:03 UTC (rev 5969)
@@ -2219,27 +2219,26 @@
 
   for (which = 0; refs[which]; which++)
     {
+      /* If we got to the next line without finding an eligible reference. */
+      if (refs[which]->start >= next_line)
+        break;
+
       /* Check the type of reference is one we are looking for. */
       if (!(  (menu_item && refs[which]->type == REFERENCE_MENU_ITEM)
            || (xref      && refs[which]->type == REFERENCE_XREF)))
         continue;
 
-      /* If reference starts in current line, it is eligible */
-      if (   refs[which]->start >= this_line
-          && refs[which]->start <  next_line)
-        closest = which;
-
-      /* If point is inside a reference, choose that one. */
-      if (   window->point >= refs[which]->start
-          && window->point <= refs[which]->end)
+      /* Reference is eligible if any part of it is in the line. */
+      if (refs[which]->start >= this_line && refs[which]->start < next_line
+          || refs[which]->start < this_line && refs[which]->end > this_line)
         {
           closest = which;
-          break;
-        }
 
-      /* If we got to the next line without finding an eligible reference. */
-      if (refs[which]->start >= next_line)
-        break;
+          /* If a reference contains the point, prefer it.  Otherwise prefer a
+             reference after the cursor to one before it. */
+          if (refs[which]->start >= window->point)
+            break;
+        }
     }
   if (closest != -1)
     defentry = refs[closest];




reply via email to

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