On Oct 15, 2011, at 4:19 AM, Andy Koppe wrote:

On 14 October 2011 14:18, Ronald Fischer wrote:
When I (to give an example) execute a "man" command within a mintty
window, and do the same within a "normal" Windows console window, I see
that those words represented as underlined words in the mintty
window, are represented by a different colour in the Windows console
windows.

I guess this different has nothing to do with the "man" command, but by
the way the terminal definition says how render "emphasized" words.
Since the Windows console (likely) can't underline, colouring is used.
It's kind of a "terminal property". Do I understand this correctly?

Yep.

I would like to understand, where this mapping to a certain colour is
done. Reason is that the colour used for my Windows console window, is a
bit hard to read and I would like to change it.

It's hardcoded in the Cygwin DLL (in
winsup/cygwin/fhandler_console.cc), so you'd have to build that
yourself to change it.

Getting man/groff to use something other than the underline attribute
might be the better approach, but I don't know how to do that.

Andy

The "Graphic Rendition" of the text is controlled by a facility called Terminfo. Here's how you can change it.

First, do:

printenv TERM

This should display "cygwin" as the terminal type. If not, replace "cygwin" in the following instructions with whatever terminal type you are using.

The terminfo files are stored under /usr/share/terminfo. If you look there you will see several subdirectories with one and two-character names. Each terminfo entry is stored in a subdirectory which corresponds to the ASCII value of its first character in hex, so the "cygwin" file is in the "63" directory. You will also find a copy under the "c" directory, but that's not the one the system uses. I presume that the one-character directories are for backwards compatibility. Make a backup copy of the "cygwin" file so you can restore the original functionality in case you mess things up.

Now go create a new working directory somewhere, perhaps under your home directory. In there, type:

infocmp cygwin >cygwin.txt

This will convert the binary terminfo file from /usr/share/terminfo/63 into a text file you can examine and edit. Edit the file with the text editor of your choice and locate the capabilities "smul" and "rmul". "smul" specifies the escape sequence that will be used to introduce "underlined" characters, and "rmul" is the sequence that turns this mode off. Set these values to whatever produces the effect you desire. (More on this below.)

After editing the source file, type:

tic cygwin.txt

This "compiles" the source file back into the binary format and overwrites the original binary file in /usr/share/terminfo/63. There are ways to redirect it to another directory, but I'll leave you to figure that out for yourself. (man tic)

Now run the man command and see if it produces the effect you want.

As for how to figure out what escape sequence to use, unpack the attached file "sgr_options,txt" and cat it in the desired terminal window. Use "cat" rather than "less" or any other program that will filter the file contents. This will show you the effects of the different options to the SGR (Set Graphic Rendition) escape sequence. For "rmul" just use "\E[0m" which turns off all modes.

\E[1m   The quick brown fox...
\E[2m   The quick brown fox...
\E[3m   The quick brown fox...
\E[4m   The quick brown fox...
\E[5m   The quick brown fox...
\E[6m   The quick brown fox...
\E[7m   The quick brown fox...
\E[8m   The quick brown fox...
\E[9m   The quick brown fox...
\E[10m  The quick brown fox...
\E[11m  The quick brown fox...
\E[12m  The quick brown fox...
\E[13m  The quick brown fox...
\E[14m  The quick brown fox...
\E[15m  The quick brown fox...
\E[16m  The quick brown fox...
\E[17m  The quick brown fox...
\E[18m  The quick brown fox...
\E[19m  The quick brown fox...
\E[20m  The quick brown fox...
\E[21m  The quick brown fox...
\E[22m  The quick brown fox...
\E[23m  The quick brown fox...
\E[24m  The quick brown fox...
\E[25m  The quick brown fox...
\E[26m  The quick brown fox...
\E[27m  The quick brown fox...
\E[28m  The quick brown fox...
\E[29m  The quick brown fox...
\E[30m  The quick brown fox...
\E[31m  The quick brown fox...
\E[32m  The quick brown fox...
\E[33m  The quick brown fox...
\E[34m  The quick brown fox...
\E[35m  The quick brown fox...
\E[36m  The quick brown fox...
\E[37m  The quick brown fox...
\E[38m  The quick brown fox...
\E[39m  The quick brown fox...
\E[40m  The quick brown fox...
\E[41m  The quick brown fox...
\E[42m  The quick brown fox...
\E[43m  The quick brown fox...
\E[44m  The quick brown fox...
\E[45m  The quick brown fox...
\E[46m  The quick brown fox...
\E[47m  The quick brown fox...
\E[48m  The quick brown fox...
\E[49m  The quick brown fox...
\E[50m  The quick brown fox...
\E[51m  The quick brown fox...
\E[52m  The quick brown fox...
\E[53m  The quick brown fox...
\E[54m  The quick brown fox...
\E[55m  The quick brown fox...
\E[56m  The quick brown fox...
\E[57m  The quick brown fox...
\E[58m  The quick brown fox...
\E[59m  The quick brown fox...
\E[60m  The quick brown fox...
\E[61m  The quick brown fox...
\E[62m  The quick brown fox...
\E[63m  The quick brown fox...
\E[64m  The quick brown fox...
\E[65m  The quick brown fox...
\E[66m  The quick brown fox...
\E[67m  The quick brown fox...
\E[68m  The quick brown fox...
\E[69m  The quick brown fox...
\E[70m  The quick brown fox...
\E[71m  The quick brown fox...
\E[72m  The quick brown fox...
\E[73m  The quick brown fox...
\E[74m  The quick brown fox...
\E[75m  The quick brown fox...
\E[76m  The quick brown fox...
\E[77m  The quick brown fox...
\E[78m  The quick brown fox...
\E[79m  The quick brown fox...
\E[80m  The quick brown fox...
\E[81m  The quick brown fox...
\E[82m  The quick brown fox...
\E[83m  The quick brown fox...
\E[84m  The quick brown fox...
\E[85m  The quick brown fox...
\E[86m  The quick brown fox...
\E[87m  The quick brown fox...
\E[88m  The quick brown fox...
\E[89m  The quick brown fox...
\E[90m  The quick brown fox...
\E[91m  The quick brown fox...
\E[92m  The quick brown fox...
\E[93m  The quick brown fox...
\E[94m  The quick brown fox...
\E[95m  The quick brown fox...
\E[96m  The quick brown fox...
\E[97m  The quick brown fox...
\E[98m  The quick brown fox...
\E[99m  The quick brown fox...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to