mirror of
https://github.com/wassname/pyreadline.git
synced 2026-07-25 13:20:55 +08:00
pyreadline-refactor: move ironpython specifics from emacs.py to hook_wrapper
This commit is contained in:
+5
-1
@@ -1,6 +1,10 @@
|
||||
2006-11-15 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu>
|
||||
* moved ironpython specifics from emacs.py->readline to a hook_wrapper
|
||||
just as in the hookwrapper for the normal console.
|
||||
|
||||
2006-11-15 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu>
|
||||
* Rearranging pyreadlineconfig.ini
|
||||
|
||||
|
||||
2006-11-13 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu>
|
||||
* Fixed bug in tab completion when point is not at end of line
|
||||
* Changed clr.AddReference to clr.AddReferenceToFileAndPath (ironpython_console)
|
||||
|
||||
@@ -388,9 +388,20 @@ def make_event_from_keydescr(keydescr):
|
||||
CTRL_C_EVENT=make_event_from_keydescr("Control-c")
|
||||
|
||||
def install_readline(hook):
|
||||
def hook_wrap():
|
||||
try:
|
||||
res=hook()
|
||||
except KeyboardInterrupt,x: #this exception does not seem to be caught
|
||||
res=""
|
||||
except EOFError:
|
||||
return None
|
||||
if res[-1:]=="\n":
|
||||
return res[:-1]
|
||||
else:
|
||||
return res
|
||||
class IronPythonWrapper(IronPythonConsole.IConsole):
|
||||
def ReadLine(self,autoIndentSize):
|
||||
return hook()
|
||||
return hook_wrap()
|
||||
def Write(self,text, style):
|
||||
System.Console.Write(text)
|
||||
def WriteLine(self,text, style):
|
||||
|
||||
@@ -107,22 +107,13 @@ class EmacsMode(basemode.BaseMode):
|
||||
self.paste_line_buffer=self.paste_line_buffer[1:]
|
||||
c.write('\r\n')
|
||||
else:
|
||||
try:
|
||||
self._readline_from_keyboard()
|
||||
except EOFError:
|
||||
if in_ironpython:
|
||||
return None
|
||||
else:
|
||||
raise
|
||||
self._readline_from_keyboard()
|
||||
c.write('\r\n')
|
||||
|
||||
self.add_history(self.l_buffer.copy())
|
||||
|
||||
log('returning(%s)' % self.l_buffer.get_line_text())
|
||||
if in_ironpython:
|
||||
return self.l_buffer.get_line_text()
|
||||
else:
|
||||
return self.l_buffer.get_line_text() + '\n'
|
||||
return self.l_buffer.get_line_text() + '\n'
|
||||
|
||||
######### History commands
|
||||
def previous_history(self, e): # (C-p)
|
||||
|
||||
Reference in New Issue
Block a user