See attached.
Here's a patch to improve the behavior of GNU APL on ANSI terminals.

David B. Lamkins <[email protected]>
2014-03-02


The underlying problem is that color numbers for the CSI m sequence
are only standardized and widely implemented for values in the range
0-7.

Also, my reading of an available spec says that use of color 8 to
provide an escape to the Xterm color palette was not correctly
implemented in GNU APL. I believe that additional parameters are
necessary following the 38 or 48. See, for example:

http://en.wikipedia.org/wiki/ANSI_escape_code

The patch retains GNU APL's default assumption of running on a
black-on-white terminal. The patched code provides a usable default
black-on-white scheme even if the terminal has a white-on-black
scheme, e.g. as is the case of the Linux console on Fedora. The
unpatched code leaves a white-on-black terminal in an unusable state
upon exit from GNU APL; the patch corrects this.

The template for the preferences is also updated to show proper ANSI
escape sequences for both the black-on-white and white-on-black cases.


Index: gnu-apl.d/preferences
===================================================================
--- gnu-apl.d/preferences	(revision 149)
+++ gnu-apl.d/preferences	(working copy)
@@ -132,10 +132,10 @@
 #                                        V        V 
 # //                    ESC  [  0  ;  3 fg  ;  4 bg  m
 # CIN-SEQUENCE           1b 5b 30 3b 33 30 3b 34 37 6d    // ESC [0;30;47m
-# COUT-SEQUENCE          1b 5b 30 3b 33 30 3b 34 38 6d    // ESC [0;30;48m
-# CERR-SEQUENCE          1b 5b 30 3b 33 35 3b 34 38 6d    // ESC [0;35;48m
-# UERR-SEQUENCE          1b 5b 30 3b 33 35 3b 34 38 6d    // ESC [0;35;48m
-# RESET-SEQUENCE         1b 5b 30 3b 33 38 3b 34 38 6d    // ESC [0;38;48m
+# COUT-SEQUENCE          1b 5b 30 3b 33 30 3b 34 37 6d    // ESC [0;30;47m
+# CERR-SEQUENCE          1b 5b 30 3b 33 35 3b 34 37 6d    // ESC [0;35;47m
+# UERR-SEQUENCE          1b 5b 30 3b 33 35 3b 34 37 6d    // ESC [0;35;47m
+# RESET-SEQUENCE         1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;40m
 # CLEAR-EOL-SEQUENCE     1b 5b 4B                         // ESC [K
 #
 # On a black background (still assuming VT100 so that the CLEAR-EOL-SEQUENCE
@@ -145,7 +145,7 @@
 # COUT-SEQUENCE          1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;40m
 # CERR-SEQUENCE          1b 5b 30 3b 33 31 3b 34 30 6d    // ESC [0;31;40m
 # UERR-SEQUENCE          1b 5b 30 3b 33 31 3b 34 30 6d    // ESC [0;31;40m
-# RESET-SEQUENCE         1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;48m
+# RESET-SEQUENCE         1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;40m
 #
 #
 
Index: src/Output.cc
===================================================================
--- src/Output.cc	(revision 149)
+++ src/Output.cc	(working copy)
@@ -110,19 +110,19 @@
 
 /// VT100 escape sequence to change to cout color
 char Output::color_COUT[21] =
-   { 27, 91, '0', ';', '3', '0', ';', '4', '8', 'm', 0 };
+   { 27, 91, '0', ';', '3', '0', ';', '4', '7', 'm', 0 };
 
 /// VT100 escape sequence to change to cerr color
 char Output::color_CERR[21] =
-   { 27, 91, '0', ';', '3', '5', ';', '4', '8', 'm', 0 };
+   { 27, 91, '0', ';', '3', '5', ';', '4', '7', 'm', 0 };
 
 /// VT100 escape sequence to change to cerr color
 char Output::color_UERR[21] =
-   { 27, 91, '0', ';', '3', '5', ';', '4', '8', 'm', 0 };
+   { 27, 91, '0', ';', '3', '5', ';', '4', '7', 'm', 0 };
 
 /// VT100 escape sequence to reset colors to their default
 char Output::color_RESET[21] =
-  { 27, 91, '0', ';', '3', '8', ';', '4', '8', 'm', 0 };
+  { 27, 91, '0', ';', '3', '7', ';', '4', '0', 'm', 0 };
 
 /// VT100 escape sequence to clear to end of line
 char Output::clear_EOL[21] =

Reply via email to