texinfo-commits
[Top][All Lists]
Advanced

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

[6586] user-chosen renditions improvements


From: Gavin D. Smith
Subject: [6586] user-chosen renditions improvements
Date: Sat, 29 Aug 2015 17:01:56 +0000

Revision: 6586
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6586
Author:   gavin
Date:     2015-08-29 17:01:54 +0000 (Sat, 29 Aug 2015)
Log Message:
-----------
user-chosen renditions improvements

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/display.c
    trunk/info/display.h
    trunk/info/session.c
    trunk/info/terminal.c
    trunk/info/variables.c
    trunk/info/variables.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-08-29 15:44:50 UTC (rev 6585)
+++ trunk/ChangeLog     2015-08-29 17:01:54 UTC (rev 6586)
@@ -1,5 +1,20 @@
 2015-08-29  Gavin Smith  <address@hidden>
 
+       * info/display.h, info/variables.h (RENDITION): Move definition.
+       * info/display.c (highlight_searches_p, xref_rendition_p): Remove.
+       * info/variables.c (set_variable_to_value): Make highlight-searches=On
+       equivalent to match-rendition=standout.
+       * info/display.c (display_process_line): If hl-ref-rendition 
+       hasn't been given, use ref-rendition for active links.
+
+       * info/terminal.c (terminal_end_bold, terminal_end_blink): 
+       Remove, repacing them with:
+       (terminal_end_all_modes): New function.
+       (terminal_switch_rendition): Manage to turn off boldface and 
+       blinking without leaving everything else turned off as well.
+
+2015-08-29  Gavin Smith  <address@hidden>
+
        * info/terminal.c (terminal_default_colour, terminal_set_colour):
        Add hooks.
 

Modified: trunk/info/display.c
===================================================================
--- trunk/info/display.c        2015-08-29 15:44:50 UTC (rev 6585)
+++ trunk/info/display.c        2015-08-29 17:01:54 UTC (rev 6586)
@@ -24,6 +24,7 @@
 #include "session.h"
 #include "tag.h"
 #include "signals.h"
+#include "variables.h"
 
 static void free_display (DISPLAY_LINE **display);
 static DISPLAY_LINE **make_display (int width, int height);
@@ -224,13 +225,6 @@
 }
 
 
-/* User variable to control whether matches from a search are highlighted. */
-int highlight_searches_p = 0;
-
-/* Controls whether cross-references and menu entries are underlined.
-   TODO: have a choice of different styles and colours. */
-int xref_rendition_p = 0;
-
 /* Given an array MATCHES with regions, and an offset *MATCH_INDEX, decide
    if we are inside a region at offset OFF.  The matches are assumed not
    to overlap and to be in order. */
@@ -468,7 +462,8 @@
           RENDITION match = {0, 0};
 
           if (in_ref_proper)
-            ref = ref_highlighted? hl_ref_rendition : ref_rendition;
+            ref = ref_highlighted && hl_ref_rendition.mask
+                    ? hl_ref_rendition : ref_rendition;
           if (in_match)
             match = match_rendition;
           if (!ref_highlighted)
@@ -527,9 +522,9 @@
 
   matches = 0;
   refs = 0;
-  if (highlight_searches_p)
+  if (match_rendition.mask)
     matches = win->matches;
-  if (xref_rendition_p)
+  if (ref_rendition.mask)
     refs = win->node->references;
 
   pl_num = 0;

Modified: trunk/info/display.h
===================================================================
--- trunk/info/display.h        2015-08-29 15:44:50 UTC (rev 6585)
+++ trunk/info/display.h        2015-08-29 17:01:54 UTC (rev 6586)
@@ -72,13 +72,4 @@
 void display_scroll_line_starts (WINDOW *window, int old_pagetop,
     long *old_starts, int old_count);
 
-typedef struct {
-    unsigned long mask;
-    unsigned long value;
-} RENDITION;
-
-extern RENDITION ref_rendition;
-extern RENDITION hl_ref_rendition;
-extern RENDITION match_rendition;
-
 #endif /* not INFO_DISPLAY_H */

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2015-08-29 15:44:50 UTC (rev 6585)
+++ trunk/info/session.c        2015-08-29 17:01:54 UTC (rev 6586)
@@ -239,7 +239,7 @@
 
       /* Some redisplay might be necessary if the cursor has moved and
          a different reference (or no reference) has to be highlighted. */
-      if (xref_rendition_p)
+      if (hl_ref_rendition.mask)
         display_update_one_window (active_window);
 
       display_cursor_at_point (active_window);

Modified: trunk/info/terminal.c
===================================================================
--- trunk/info/terminal.c       2015-08-29 15:44:50 UTC (rev 6585)
+++ trunk/info/terminal.c       2015-08-29 17:01:54 UTC (rev 6586)
@@ -63,9 +63,8 @@
 VFunction *terminal_begin_underline_hook = NULL;
 VFunction *terminal_end_underline_hook = NULL;
 VFunction *terminal_begin_bold_hook = NULL;
-VFunction *terminal_end_bold_hook = NULL;
 VFunction *terminal_begin_blink_hook = NULL;
-VFunction *terminal_end_blink_hook = NULL;
+VFunction *terminal_end_all_modes_hook = NULL;
 VFunction *terminal_default_colour_hook = NULL;
 VFunction *terminal_set_colour_hook = NULL;
 VFunction *terminal_prep_terminal_hook = NULL;
@@ -457,17 +456,6 @@
 }
 
 void
-terminal_end_bold (void)
-{
-  if (terminal_end_bold_hook)
-    (*terminal_end_bold_hook) ();
-  else
-    {
-      send_to_terminal (term_me); /* FIXME - this turns off too much */
-    }
-}
-
-void
 terminal_begin_blink (void)
 {
   if (terminal_begin_blink_hook)
@@ -479,13 +467,13 @@
 }
 
 void
-terminal_end_blink (void)
+terminal_end_all_modes (void)
 {
-  if (terminal_end_blink_hook)
-    (*terminal_end_blink_hook) ();
+  if (terminal_end_all_modes_hook)
+    (*terminal_end_all_modes_hook) ();
   else
     {
-      send_to_terminal (term_me); /* FIXME */
+      send_to_terminal (term_me);
     }
 }
 
@@ -640,10 +628,24 @@
    rendition. */
 static unsigned long terminal_rendition;
 
+/* Modes for which there aren't termcap entries for turning them off. */
+#define COMBINED_MODES (BOLD_MASK | BLINK_MASK)
+
 void
 terminal_switch_rendition (unsigned long new)
 {
   unsigned long old = terminal_rendition;
+  int all_modes_turned_off = 0;
+
+  if ((old & new & COMBINED_MODES) != (old & COMBINED_MODES))
+    {
+      /* Some modes we can't turn off by themselves, so if we need to turn
+         one of them off, turn back on all the ones that should be on 
+         afterwards. */
+      terminal_end_all_modes ();
+      old = 0;
+    }
+
   if ((new & COLOUR_MASK) != (old & COLOUR_MASK))
     {
       /* Switch colour. */
@@ -677,15 +679,11 @@
     {
       if ((new & BOLD_MASK))
         terminal_begin_bold ();
-      else
-        terminal_end_bold ();
     }
   if ((new & BLINK_MASK) != (old & BLINK_MASK))
     {
       if ((new & BLINK_MASK))
         terminal_begin_blink ();
-      else
-        terminal_end_blink ();
     }
   terminal_rendition = new;
 }

Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c      2015-08-29 15:44:50 UTC (rev 6585)
+++ trunk/info/variables.c      2015-08-29 17:01:54 UTC (rev 6586)
@@ -53,7 +53,9 @@
    this variable. */
 char *rendition_variable = 0;
 
+static char *highlight_searches;
 
+
 /* Note that the 'where_set' field of each element in the array is
    not given and defaults to 0. */
 VARIABLE_ALIST info_variables[] = {
@@ -126,14 +128,6 @@
       N_("Length of time in milliseconds to wait for the next byte in a 
sequence indicating that a key has been pressed"),
     &key_time, NULL },
 
-  { "highlight-searches",
-      N_("Highlight search matches"),
-    &highlight_searches_p, (char **)on_off_choices },
-
-  { "xref-rendition",
-      N_("Underline cross-references and menu entries"),
-    &xref_rendition_p, (char **)on_off_choices },
-
   { "mouse",
       N_("Method to use to track mouse events"),
     &mouse_protocol, (char **)mouse_choices },
@@ -142,6 +136,10 @@
       N_("How to follow a cross-reference"),
     &follow_strategy, (char **)follow_strategy_choices },
 
+  { "highlight-searches",
+      N_("Highlight search matches"),
+    &highlight_searches, (char **)on_off_choices },
+
   { "ref-rendition",
       N_("Styles for links"),
     &ref_rendition, &rendition_variable },
@@ -350,7 +348,19 @@
   if (var->choices)
     {
       register int j;
+      VARIABLE_ALIST our_var;
 
+      /* "highlight-searches=On" is equivalent to
+         "match-rendition=standout". */
+      if (var->value == &highlight_searches)
+        {
+          our_var.choices = &rendition_variable;
+          our_var.value = &match_rendition;
+          var = &our_var;
+          value = highlight_searches = xstrdup ("standout");
+          /* Save new string to prevent a memory leak being apparent. */
+        }
+
       if (var->choices != &rendition_variable)
         {
           /* Find the choice in our list of choices. */

Modified: trunk/info/variables.h
===================================================================
--- trunk/info/variables.h      2015-08-29 15:44:50 UTC (rev 6585)
+++ trunk/info/variables.h      2015-08-29 17:01:54 UTC (rev 6586)
@@ -80,10 +80,17 @@
 extern int infopath_no_defaults_p;
 extern int preprocess_nodes_p;
 extern int key_time;
-extern int highlight_searches_p;
-extern int xref_rendition_p;
 extern int mouse_protocol;
 extern int follow_strategy;
 
+typedef struct {
+    unsigned long mask;
+    unsigned long value;
+} RENDITION;
 
+extern RENDITION ref_rendition;
+extern RENDITION hl_ref_rendition;
+extern RENDITION match_rendition;
+
+
 #endif /* not INFO_VARIABLES_H */




reply via email to

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