texinfo-commits
[Top][All Lists]
Advanced

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

[5753] check if the next search match starts immediately after the last


From: Gavin D. Smith
Subject: [5753] check if the next search match starts immediately after the last one
Date: Sat, 16 Aug 2014 14:28:28 +0000

Revision: 5753
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5753
Author:   gavin
Date:     2014-08-16 14:28:27 +0000 (Sat, 16 Aug 2014)
Log Message:
-----------
check if the next search match starts immediately after the last one

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-08-15 23:49:23 UTC (rev 5752)
+++ trunk/ChangeLog     2014-08-16 14:28:27 UTC (rev 5753)
@@ -1,5 +1,10 @@
 2014-08-16  Gavin Smith  <address@hidden>
 
+       * info/display.c (display_update_window_1): Check if the next search
+       match starts immediately after the last one.
+
+2014-08-16  Gavin Smith  <address@hidden>
+
        * info/info.c (add_initial_nodes): Error message if --node used
        without a filename being specified.
        * info/t/node-no-file.sh: New test.

Modified: trunk/info/display.c
===================================================================
--- trunk/info/display.c        2014-08-15 23:49:23 UTC (rev 5752)
+++ trunk/info/display.c        2014-08-16 14:28:27 UTC (rev 5753)
@@ -278,19 +278,33 @@
 
       if (matches && match_index != win->match_count)
         {
-          if (!in_match && cur_ptr >= win->node->contents
+          int new_in_match = in_match;
+          if (in_match && cur_ptr >= win->node->contents
+                             + matches[match_index].rm_eo)
+            {
+              new_in_match = 0;
+              match_index++;
+
+              /* Carry on to check if the next match starts immediately. */
+            } 
+
+          if (match_index != win->match_count
+              && !new_in_match && cur_ptr >= win->node->contents
                              + matches[match_index].rm_so)
             {
-              text_buffer_add_string (&tb_printed_line, term_so, 
strlen(term_so));
-              in_match = 1;
+              new_in_match = 1;
             } 
-          else if (in_match && cur_ptr >= win->node->contents
-                             + matches[match_index].rm_eo)
+
+          if (new_in_match != in_match)
             {
-              text_buffer_add_string (&tb_printed_line, term_se, 
strlen(term_se));
-              in_match = 0;
-              match_index++;
-            } 
+              in_match = new_in_match;
+              if (in_match)
+                text_buffer_add_string (&tb_printed_line, term_so,
+                                        strlen (term_so));
+              else
+                text_buffer_add_string (&tb_printed_line, term_se,
+                                        strlen (term_se));
+            }
         }
 
       if (delim || pl_chars + pchars >= win->width)




reply via email to

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