console enhancements: mouse events etc

Corinna Vinschen corinna-cygwin@cygwin.com
Sat Dec 19 15:42:00 GMT 2009


On Dec 17 03:11, Thomas Wolff wrote:
> Hi,
> here is my VT100 graphics mode patch, plus the one-liner I forgot to
> mention in the change log last time, I hope that's OK.
> Thomas

> 	* fhandler_console.cc (write_console): Check for VT100 
> 	graphics mode and transform wide characters in ASCII small 
> 	letter range to corresponding graphics.
> 	(__vt100_conv): Table to transform small ASCII letters to line 
> 	drawing graphics for use in VT100 graphics mode.
> 	(write_normal): Check for SO/SI control characters to 
> 	enable/disable VT100 graphics mode.
> 	(base_chars): Enable SO/SI control characters for detection.
> 	(write): Check for ESC ( 0 / ESC ( B escape sequences to 
> 	enable/disable VT100 graphics mode. Also detect ">" while 
> 	parsing ESC [ sequences to distinguish specific requests.
> 	(char_command): Distinguish Secondary from Primary Device Attribute 
> 	request to report more details about cygwin console terminal version.
> 	* fhandler.h (vt100_graphics_mode_active): New flag to indicate mode.
> 	(saw_greater_than_sign): New parse flag for ESC [ > sequences.
> 	(gotparen, gotrparen): New state values to parse ESC ( / ) sequences.
> 
> 	* fhandler_console.cc (read): Allow combined Alt-AltGr modifiers 
> 	to also produce an ESC prefix like a plain Alt modifier, e.g. to make 
> 	Alt-@ work on a keyboard where @ is AltGr-q.

Thanks, applied with a change.  I removed the whole lot of question
marks which were apparently meant to be the UTF-8 representation of the
vt100 graphical chars, and replaced them with the textual description
from the Unicode character table, like this:

  /* VT100 line drawing graphics mode maps `abcdefghijklmnopqrstuvwxyz{|}~ to
     graphical characters */
  static wchar_t __vt100_conv [31] = {
	  0x25C6, /* Black Diamond */
	  0x2592, /* Medium Shade */
	  0x2409, /* Symbol for Horizontal Tabulation */
	  0x240C, /* Symbol for Form Feed */
	  0x240D, /* Symbol for Carriage Return */
	  0x240A, /* Symbol for Line Feed */
	  0x00B0, /* Degree Sign */
	  0x00B1, /* Plus-Minus Sign */
	  0x2424, /* Symbol for Newline */
	  0x240B, /* Symbol for Vertical Tabulation */
	  0x2518, /* Box Drawings Light Up And Left */
	  0x2510, /* Box Drawings Light Down And Left */
	  0x250C, /* Box Drawings Light Down And Right */
	  0x2514, /* Box Drawings Light Up And Right */
	  0x253C, /* Box Drawings Light Vertical And Horizontal */
	  0x23BA, /* Horizontal Scan Line-1 */
	  0x23BB, /* Horizontal Scan Line-3 */
	  0x2500, /* Box Drawings Light Horizontal */
	  0x23BC, /* Horizontal Scan Line-7 */
	  0x23BD, /* Horizontal Scan Line-9 */
	  0x251C, /* Box Drawings Light Vertical And Right */
	  0x2524, /* Box Drawings Light Vertical And Left */
	  0x2534, /* Box Drawings Light Up And Horizontal */
	  0x252C, /* Box Drawings Light Down And Horizontal */
	  0x2502, /* Box Drawings Light Vertical */
	  0x2264, /* Less-Than Or Equal To */
	  0x2265, /* Greater-Than Or Equal To */
	  0x03C0, /* Greek Small Letter Pi */
	  0x2260, /* Not Equal To */
	  0x00A3, /* Pound Sign */
	  0x00B7, /* Middle Dot */
  };

This avoids usage of any non-ASCII characters in the sources.  While
UTF-8 is a good idea in general, we should avoid to use it in the
source code.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-patches mailing list