texinfo-commits
[Top][All Lists]
Advanced

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

[6585] add hooks for terminal colour-changing functions


From: Gavin D. Smith
Subject: [6585] add hooks for terminal colour-changing functions
Date: Sat, 29 Aug 2015 15:44:52 +0000

Revision: 6585
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6585
Author:   gavin
Date:     2015-08-29 15:44:50 +0000 (Sat, 29 Aug 2015)
Log Message:
-----------
add hooks for terminal colour-changing functions

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-08-29 14:41:35 UTC (rev 6584)
+++ trunk/ChangeLog     2015-08-29 15:44:50 UTC (rev 6585)
@@ -1,5 +1,10 @@
 2015-08-29  Gavin Smith  <address@hidden>
 
+       * info/terminal.c (terminal_default_colour, terminal_set_colour):
+       Add hooks.
+
+2015-08-29  Gavin Smith  <address@hidden>
+
        * info/variable.c (set_variable_to_value): Handle rendition
        variables in user init file.
        (info_variables): Add user variables "ref-rendition",

Modified: trunk/info/terminal.c
===================================================================
--- trunk/info/terminal.c       2015-08-29 14:41:35 UTC (rev 6584)
+++ trunk/info/terminal.c       2015-08-29 15:44:50 UTC (rev 6585)
@@ -66,6 +66,8 @@
 VFunction *terminal_end_bold_hook = NULL;
 VFunction *terminal_begin_blink_hook = NULL;
 VFunction *terminal_end_blink_hook = NULL;
+VFunction *terminal_default_colour_hook = NULL;
+VFunction *terminal_set_colour_hook = NULL;
 VFunction *terminal_prep_terminal_hook = NULL;
 VFunction *terminal_unprep_terminal_hook = NULL;
 VFunction *terminal_up_line_hook = NULL;
@@ -618,13 +620,19 @@
 static void
 terminal_default_colour (void)
 {
-  tputs (term_op, 0, output_character_function);
+  if (terminal_default_colour_hook)
+    (*terminal_default_colour_hook) ();
+  else
+    tputs (term_op, 0, output_character_function);
 }
 
 static void
 terminal_set_colour (int colour)
 {
-  tputs (tgoto (term_AF, 0, colour), 0, output_character_function);
+  if (terminal_set_colour_hook)
+    (*terminal_set_colour_hook) (colour);
+  else
+    tputs (tgoto (term_AF, 0, colour), 0, output_character_function);
 }
 
 /* Information about what styles like colour, underlining, boldface are
@@ -647,7 +655,7 @@
         }
       else if ((new & COLOUR_MASK) >= 8)
         {
-          terminal_set_colour ((new & COLOUR_MASK - 8));
+          terminal_set_colour ((new & COLOUR_MASK) - 8);
         }
       /* Colour values from 1 to 7 don't do anything right now. */
     }




reply via email to

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