Changeset 2924

Show
Ignore:
Timestamp:
01/07/08 12:46:56 (1 year ago)
Author:
jstenar
Message:

pyreadline: Added code to make interoperability with emacs work again.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pyreadline/trunk/doc/ChangeLog

    r2921 r2924  
     12008-01-07 Jörgen Stenarson  <jorgen.stenarson -at- bostream.nu> 
     2    * Reintroduced code to make pyreadline work with emacs. Not tested. 
     3      Requested by Frank Wang. 
     4 
    152008-01-04 Jörgen Stenarson  <jorgen.stenarson -at- bostream.nu> 
    26    * Chunking calls to WriteConsoleW to ensure not exceeding 64k limit 
  • pyreadline/trunk/pyreadline/console/console.py

    r2921 r2924  
    1414# primitive debug printing that won't interfere with the screen 
    1515 
    16 import sys 
     16import sys,os 
    1717import traceback 
    1818import re 
     
    146146    'WriteConsoleW', 
    147147    'WriteConsoleOutputCharacterW', 
     148    'WriteFile', 
    148149    ] 
    149150 
     
    346347        return n 
    347348 
    348  
    349349    def write_plain(self, text, attr=None): 
    350350        '''write text at current cursor position.''' 
     
    357357            self.WriteConsoleW(self.hout, ensure_unicode(short_chunk), len(short_chunk), byref(junk), None) 
    358358        return len(text) 
     359 
     360    #This function must be used to ensure functioning with EMACS 
     361    #Emacs sets the EMACS environment variable 
     362    if os.environ.has_key("EMACS"): 
     363        def write_color(self, text, attr=None): 
     364            junk = c_int(0) 
     365            self.WriteFile(self.hout, text, len(text), byref(junk),None) 
     366            return len(text) 
     367        write_plain = write_color 
    359368 
    360369    # make this class look like a file object