texinfo-commits
[Top][All Lists]
Advanced

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

[5720] remove info_error_was_printed


From: Gavin D. Smith
Subject: [5720] remove info_error_was_printed
Date: Sat, 26 Jul 2014 10:12:31 +0000

Revision: 5720
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5720
Author:   gavin
Date:     2014-07-26 10:12:29 +0000 (Sat, 26 Jul 2014)
Log Message:
-----------
remove info_error_was_printed

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-07-25 17:14:21 UTC (rev 5719)
+++ trunk/ChangeLog     2014-07-26 10:12:29 UTC (rev 5720)
@@ -1,3 +1,13 @@
+2014-07-26  Gavin Smith  <address@hidden>
+
+       * info/session.c (info_search_1): Unused 'key' argument removed.
+       Rely on info_search_internal to print an error message.
+       (info_search_internal): Print an error message if search failed if not
+       in interactive search.
+       * info/window.c (set_window_pagetop): Comment changed.
+       * info/info.c (info_error_was_printed): Variable removed.  All
+       accesses removed.
+
 2014-07-25  Gavin Smith  <address@hidden>
 
        * info/infokey.c (compile): Keep going for unrecognized or invalid
@@ -51,7 +61,6 @@
        and close_info_session instead of info_session.
        * info/session.c (fill_input_buffer): Call close_info_session if
        reading input failed.
-       
 
 2014-07-22  Gavin Smith  <address@hidden>
 

Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c   2014-07-25 17:14:21 UTC (rev 5719)
+++ trunk/info/info.c   2014-07-26 10:12:29 UTC (rev 5720)
@@ -901,9 +901,6 @@
 
 /* Error handling.  */
 
-/* Non-zero if an error has been signalled. */
-int info_error_was_printed = 0;
-
 /* Non-zero means ring terminal bell on errors. */
 int info_error_rings_bell_p = 1;
 
@@ -965,8 +962,6 @@
 void
 vinfo_error (const char *format, va_list ap)
 {
-  info_error_was_printed = 1;
-
   if (!info_windows_initialized_p || display_inhibited)
     {
       fprintf (stderr, "%s: ", program_name);

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-07-25 17:14:21 UTC (rev 5719)
+++ trunk/info/session.c        2014-07-26 10:12:29 UTC (rev 5720)
@@ -239,7 +239,6 @@
         continue;
 
       window_clear_echo_area ();
-      info_error_was_printed = 0;
 
       if (key == KEY_MOUSE)
         mouse_event_handler ();
@@ -3381,8 +3380,7 @@
    to gc even those file buffer contents which had to be uncompressed. */
 int gc_compressed_files = 0;
 
-static void info_search_1 (WINDOW *window, int count,
-                          unsigned char key, int case_sensitive,
+static void info_search_1 (WINDOW *window, int count, int case_sensitive,
                           int ask_for_string, long start);
 #define DFL_START (-1) /* a special value for the START argument of
                          info_search_1, meaning to use the default
@@ -3632,7 +3630,7 @@
 
       number_of_tags = i;
 
-      /* Our tag wasn't found. */
+      /* Our tag wasn't found.  This shouldn't happen. */
       if (current_tag == -1)
         return -1;
 
@@ -3667,9 +3665,9 @@
                 break;
             }
 
-          /* If we got past out starting point, bail out.  */
+          /* If we got past our starting point, bail out.  */
           if (i == current_tag)
-            return -1;
+            break;
           current_tag = i;
 
           /* Display message when searching a new subfile. */
@@ -3724,9 +3722,14 @@
 
           if (result == search_failure
              || strcmp (initial_nodename, tag->nodename) == 0)
-            return -1;
+            break;
         }
     }
+
+  /* Not in interactive search. */
+  if (!echo_area_is_active)
+    info_error ("%s", _("Search failed."));
+
   return -1;
 }
 
@@ -3735,14 +3738,14 @@
 {
   last_search_direction = count > 0 ? 1 : -1;
   last_search_case_sensitive = 1;
-  info_search_1 (window, count, key, 1, 1, DFL_START);
+  info_search_1 (window, count, 1, 1, DFL_START);
 }
 
 DECLARE_INFO_COMMAND (info_search, _("Read a string and search for it"))
 {
   last_search_direction = count > 0 ? 1 : -1;
   last_search_case_sensitive = 0;
-  info_search_1 (window, count, key, 0, 1, DFL_START);
+  info_search_1 (window, count, 0, 1, DFL_START);
 }
 
 DECLARE_INFO_COMMAND (info_search_backward,
@@ -3750,7 +3753,7 @@
 {
   last_search_direction = count > 0 ? -1 : 1;
   last_search_case_sensitive = 0;
-  info_search_1 (window, -count, key, 0, 1, DFL_START);
+  info_search_1 (window, -count, 0, 1, DFL_START);
 }
 
 /* Common entry point for the search functions.  Arguments:
@@ -3766,8 +3769,8 @@
                    for details.
 */
 static void
-info_search_1 (WINDOW *window, int count, unsigned char key,
-              int case_sensitive, int ask_for_string, long start)
+info_search_1 (WINDOW *window, int count, int case_sensitive,
+               int ask_for_string, long start)
 {
   char *line, *prompt;
   int result, old_pagetop;
@@ -3858,9 +3861,7 @@
                                    active_window, direction, case_sensitive,
                                   bindp);
 
-  if (result != 0 && !info_error_was_printed)
-    info_error ("%s", _("Search failed."));
-  else if (old_pagetop != active_window->pagetop)
+  if (result == 0 && old_pagetop != active_window->pagetop)
     {
       int new_pagetop;
 
@@ -3892,11 +3893,11 @@
       else
        n = window->node->nodelen;
       info_search_1 (window, last_search_direction * count,
-                    key, last_search_case_sensitive, 0, n);
+                    last_search_case_sensitive, 0, n);
     }
   else
     info_search_1 (window, last_search_direction * count,
-                   key, last_search_case_sensitive, 0, DFL_START);
+                   last_search_case_sensitive, 0, DFL_START);
 }
 
 DECLARE_INFO_COMMAND (info_search_previous,
@@ -3913,11 +3914,11 @@
       if (n < 0)
        n = 0;
       info_search_1 (window, -last_search_direction * count,
-                    key, last_search_case_sensitive, 0, n);
+                    last_search_case_sensitive, 0, n);
     }
   else
     info_search_1 (window, -last_search_direction * count,
-                   key, last_search_case_sensitive, 0, DFL_START);
+                   last_search_case_sensitive, 0, DFL_START);
 }
 
 /* **************************************************************** */

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-07-25 17:14:21 UTC (rev 5719)
+++ trunk/info/window.c 2014-07-26 10:12:29 UTC (rev 5720)
@@ -731,7 +731,7 @@
 }
 
 /* Change the pagetop of WINDOW to DESIRED_TOP, perhaps scrolling the screen
-   to do so. */
+   to do so.  WINDOW->pagetop should be the currently displayed pagetop. */
 void
 set_window_pagetop (WINDOW *window, int desired_top)
 {




reply via email to

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