Changeset 1452
- Timestamp:
- 07/18/06 13:57:25 (2 years ago)
- Files:
-
- pyreadline/trunk/doc/ChangeLog (modified) (1 diff)
- pyreadline/trunk/pyreadline/ansi.py (added)
- pyreadline/trunk/pyreadline/console.py (modified) (4 diffs)
- pyreadline/trunk/pyreadline/rlmain.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pyreadline/trunk/doc/ChangeLog
r1382 r1452 1 2006-07-18 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu> 2 * Added AnsiState class to simplify work with getting the aansi color handling to work properly 3 * Added NOP function to readline class to have an empty function to bind to tab completion 4 * Tab completion bound to do nothing method NOP by default. 5 1 6 2006-06-27 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu> 2 7 * Changes from yesterday were not correct. Resulted in invisible docstrings pyreadline/trunk/pyreadline/console.py
r1382 r1452 156 156 0x5b:1, # windows key 157 157 } 158 from ansi import AnsiState,AnsiWriter 159 158 160 159 161 class Console(object): … … 184 186 self.attr = info.wAttributes 185 187 self.saveattr = info.wAttributes # remember the initial colors 188 189 self.defaultstate=AnsiState() 190 self.defaultstate.winattr=info.wAttributes 191 192 self.ansiwriter=AnsiWriter(self.defaultstate) 193 194 186 195 log('initial attr=%x' % self.attr) 187 196 … … 202 211 import atexit 203 212 atexit.register(exit) 204 213 214 215 216 217 205 218 206 219 def __del__(self): … … 342 355 return n 343 356 357 def write_color(self, text, attr=None): 358 n,res= self.ansiwriter.write_color(text,attr) 359 junk = c_int(0) 360 for attr,chunk in res: 361 log(str(attr)) 362 log(str(chunk)) 363 self.SetConsoleTextAttribute(self.hout, attr.winattr) 364 self.WriteConsoleA(self.hout, chunk, len(chunk), byref(junk), None) 365 return n 366 344 367 def write_plain(self, text, attr=None): 345 368 '''write text at current cursor position.''' pyreadline/trunk/pyreadline/rlmain.py
r1382 r1452 180 180 control, meta, shift, code = event.keyinfo 181 181 event.keyinfo = (control, True, shift, code) 182 182 log("event:%s,%s"%(str(event.keyinfo),event.char)) 183 183 #Process exit keys. Only exit on empty line 184 184 if event.keyinfo in self.exit_dispatch: … … 1120 1120 pass 1121 1121 1122 def NOP(self,e): 1123 pass 1124 1122 1125 def _bind_key(self, key, func): 1123 1126 '''setup the mapping from key to call the function.''' … … 1139 1142 1140 1143 # I often accidentally hold the shift or control while typing space 1144 self._bind_key('Tab', self.NOP) 1141 1145 self._bind_key('Shift-space', self.self_insert) 1142 1146 self._bind_key('Control-space', self.self_insert)
