##// END OF EJS Templates
color: for the sake of "less -R", default to ansi in auto mode (issue2792)...
Brodie Rao -
r14769:9adce4b3 stable
parent child Browse files
Show More
@@ -75,6 +75,14 b" ECMA-48 mode, the options are 'bold', 'i"
75 Some may not be available for a given terminal type, and will be
75 Some may not be available for a given terminal type, and will be
76 silently ignored.
76 silently ignored.
77
77
78 Note that on some systems, terminfo mode may cause problems when using
79 color with the pager extension and less -R. less with the -R option
80 will only display ECMA-48 color codes, and terminfo mode may sometimes
81 emit codes that less doesn't understand. You can work around this by
82 either using ansi mode (or auto mode), or by using less -r (which will
83 pass through all terminal control codes, not just color control
84 codes).
85
78 Because there are only eight standard colors, this module allows you
86 Because there are only eight standard colors, this module allows you
79 to define color names for other color slots which might be available
87 to define color names for other color slots which might be available
80 for your terminal type, assuming terminfo mode. For instance::
88 for your terminal type, assuming terminfo mode. For instance::
@@ -89,15 +97,15 b' that have brighter colors defined in the'
89 defined colors may then be used as any of the pre-defined eight,
97 defined colors may then be used as any of the pre-defined eight,
90 including appending '_background' to set the background to that color.
98 including appending '_background' to set the background to that color.
91
99
92 The color extension will try to detect whether to use terminfo, ANSI
100 By default, the color extension will use ANSI mode (or win32 mode on
93 codes or Win32 console APIs, unless it is made explicit; e.g.::
101 Windows) if it detects a terminal. To override auto mode (to enable
102 terminfo mode, for example), set the following configuration option::
94
103
95 [color]
104 [color]
96 mode = ansi
105 mode = terminfo
97
106
98 Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will
107 Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will
99 disable color.
108 disable color.
100
101 '''
109 '''
102
110
103 import os
111 import os
@@ -168,10 +176,8 b' def _modesetup(ui, opts):'
168 if os.name == 'nt' and 'TERM' not in os.environ:
176 if os.name == 'nt' and 'TERM' not in os.environ:
169 # looks line a cmd.exe console, use win32 API or nothing
177 # looks line a cmd.exe console, use win32 API or nothing
170 realmode = 'win32'
178 realmode = 'win32'
171 elif not formatted:
179 else:
172 realmode = 'ansi'
180 realmode = 'ansi'
173 else:
174 realmode = 'terminfo'
175
181
176 if realmode == 'win32':
182 if realmode == 'win32':
177 if not w32effects:
183 if not w32effects:
General Comments 0
You need to be logged in to leave comments. Login now