Fixes to docs and tests.

This commit is contained in:
Jorgen Stenarson
2011-01-12 20:06:15 +01:00
parent 71187635d0
commit 09f5e4a145
11 changed files with 68 additions and 17 deletions
+2 -1
View File
@@ -13,8 +13,9 @@ Contents:
introduction
installation
usage
known_issues
bindable_commands
known_issues
changelog
Indices and tables
==================
+6
View File
@@ -11,6 +11,8 @@ like python library can also be useful when implementing commandline like
interfaces in GUIs. The use of pyreadline for anything but the windows
console is still under development.
The pyreadline module does not yet support Python 3.x this will be targeted for the 2.0 version.
Dependencies
------------
@@ -25,3 +27,7 @@ Unfortunately the module rlcompleter, the module that provides tab completion, i
.. literalinclude:: ../../readline.py
History
-------
The pyreadline package is based on the ctypes based UNC readline package by Gary Bishop.
+8 -3
View File
@@ -2,9 +2,14 @@
Known issues
============
* If you do not want pyreadline at the standard windows prompt. Delete readline.py
from the install directory. This will not interfere with ipython usage, but you will
not be able to use the rlcompleter module which requires the readline.py module.
* If you do not want pyreadline at the standard windows prompt. Delete readline.py
from the install directory. This will not interfere with ipython usage, but you will
not be able to use the rlcompleter module which requires the readline.py module.
* reverse search does not work
* #488177 exceptions occur when using pyreadline on windows 2008 r2
* #526850 pyreadline causes conhost.exe to crash on windows 7. When pasting long text (>230 characters)
python crashes. Has been observed on Windows 7 with pyreadline 1.5, not a confirmed problem with pyreadline 1.6 series.
Workaround is to use the pyreadline paste instead i.e. ctrl-v.
+19
View File
@@ -41,6 +41,25 @@ a python syntax is used instead. The available commands are:
debug_output
Turn on debug output (on|off). Not implemented yet.
disable_readline
Disable pyreadline completely (True|False).
allow_ctrl_c
Allows use of ctrl-c as copy key, still propagate keyboardinterrupt when not waiting for input.
ctrl_c_tap_time_interval
Set the ctrl-c double tap time interval to be used before issuing a KeyboadInterupt. Used
to be able to have ctrl-c bound to copy.
history_filename
Set name of history file. Default is %USERPROFILE%/.pythonhistory
history_length
Set max length of history file default 200
Here is the example config file shipped with pyreadline:
.. literalinclude:: ../../pyreadline/configuration/pyreadlineconfig.ini
@@ -1,4 +1,5 @@
#Bind keys for exit (keys only work on empty lines
#disable_readline(True) #Disable pyreadline completely.
debug_output("off") #"on" saves log info to./pyreadline_debug_log.txt
#"on_nologfile" only enables print warning messages
bind_exit_key("Control-d")
+11 -1
View File
@@ -15,8 +15,18 @@ except ImportError:
else:
#import tab completion functionality
import rlcompleter
completer_obj = rlcompleter.Completer()
def nop(val, word):
return word
#In python 2.6 the default rlcompleter module adds an open parenthesis on all
#callables if you want this behaviour use uncomment code below
completer_obj._callable_postfix = nop
readline.set_completer(completer_obj.complete)
#activate tab completion
readline.parse_and_bind("tab: complete")
readline.read_history_file()
atexit.register(readline.write_history_file)
del readline,rlcompleter,atexit
del readline, rlcompleter, atexit
+1
View File
@@ -327,6 +327,7 @@ class ViCommand:
self.readline._vi_multiplier2 = ''
self.set_override_multiplier (0)
self.skip_multipler = False
self.tabstop = 4
self.dct_fcn = {
ord('$') : self.key_dollar,
ord('^') : self.key_hat,
+1 -2
View File
@@ -42,7 +42,7 @@ Features:
where x is your preferred tap time window, default 0.3 s.
* paste pastes first line of content on clipboard.
* ipython_paste, pastes tab-separated data as list of lists or numpy array if all data is numeric
* paste_mulitline_code pastes multi line code, removing any empty lines.
* paste_mulitline_code pastes multi line code, removing any empty lines.
"""
@@ -72,7 +72,6 @@ classifiers = [u'Development Status :: 5 - Production/Stable',
u'Programming Language :: Python :: 2.5',
u'Programming Language :: Python :: 2.6',
u'Programming Language :: Python :: 2.7',
]
+4
View File
@@ -56,6 +56,10 @@ class Event:
self.char=u'\x1b'
elif char==u"backspace":
self.char=u'\x08'
elif char==u"tab":
self.char=u'\t'
elif char==u"space":
self.char=u' '
else:
self.char = char
+13 -8
View File
@@ -71,7 +71,7 @@ class EmacsModeTest (EmacsMode):
self.l_buffer.reset_line ()
def mock_completer (self, text, state):
return self.lst_completions [state]
return self.lst_completions[state]
#----------------------------------------------------------------------
@@ -347,16 +347,21 @@ class TestsHistory (unittest.TestCase):
logger.sock_silent=False
log("-"*50)
r=EmacsModeTest()
r.completer=rlcompleter.Completer().complete
r._bind_key("tab",r.complete)
r = EmacsModeTest()
completer_obj = rlcompleter.Completer()
def nop(val, word):
return word
completer_obj._callable_postfix = nop
r.completer = completer_obj.complete
r._bind_key("tab", r.complete)
r.input(u'"exi(ksdjksjd)"')
r.input(u'Control-a')
r.input(u'Right')
r.input(u'Right')
r.input(u'Right')
r.input(u'Tab')
self.assert_line(r,"exit(ksdjksjd)",4)
self.assert_line(r, "exit(ksdjksjd)",4)
r.input(u'Escape')
r.input(u'"exi"')
@@ -369,9 +374,9 @@ class TestsHistory (unittest.TestCase):
def assert_line(self,r,line,cursor):
self.assertEqual (r.line, line)
self.assertEqual (r.line_cursor, cursor)
def assert_line(self, r, line,cursor):
self.assertEqual(r.line, line)
self.assertEqual(r.line_cursor, cursor)
#----------------------------------------------------------------------
# utility functions
+2 -2
View File
@@ -52,8 +52,8 @@ class ViModeTest (ViMode):
lst_key = [keytext]
for key in lst_key:
keyinfo, event = keytext_to_keyinfo_and_event (key)
dispatch_func = self.key_dispatch.get( keyinfo.tuple(),self.vi_key)
self.tested_commands[dispatch_func.__name__]=dispatch_func
dispatch_func = self.key_dispatch.get(keyinfo.tuple(), self.vi_key)
self.tested_commands[dispatch_func.__name__] = dispatch_func
dispatch_func (event)
def vi_accept_line (self, e):