diff --git a/doc/source/index.rst b/doc/source/index.rst index 071ce8c..1b39508 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -13,8 +13,9 @@ Contents: introduction installation usage - known_issues bindable_commands + known_issues + changelog Indices and tables ================== diff --git a/doc/source/introduction.rst b/doc/source/introduction.rst index 4ca1c57..924a7a4 100644 --- a/doc/source/introduction.rst +++ b/doc/source/introduction.rst @@ -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. diff --git a/doc/source/known_issues.rst b/doc/source/known_issues.rst index c24d329..b2a6da1 100644 --- a/doc/source/known_issues.rst +++ b/doc/source/known_issues.rst @@ -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. diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 4fbc00f..d6a5142 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -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 diff --git a/pyreadline/configuration/pyreadlineconfig.ini b/pyreadline/configuration/pyreadlineconfig.ini index 0a4cd77..9af58c0 100644 --- a/pyreadline/configuration/pyreadlineconfig.ini +++ b/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") diff --git a/pyreadline/configuration/startup.py b/pyreadline/configuration/startup.py index c425398..ce491d2 100644 --- a/pyreadline/configuration/startup.py +++ b/pyreadline/configuration/startup.py @@ -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 diff --git a/pyreadline/modes/vi.py b/pyreadline/modes/vi.py index 9481c07..b228727 100644 --- a/pyreadline/modes/vi.py +++ b/pyreadline/modes/vi.py @@ -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, diff --git a/pyreadline/release.py b/pyreadline/release.py index b5e4b5f..d5ade07 100644 --- a/pyreadline/release.py +++ b/pyreadline/release.py @@ -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', - ] diff --git a/pyreadline/test/common.py b/pyreadline/test/common.py index 783743d..cc24dd4 100644 --- a/pyreadline/test/common.py +++ b/pyreadline/test/common.py @@ -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 diff --git a/pyreadline/test/emacs_test.py b/pyreadline/test/emacs_test.py index 81d4e9d..c9d32a9 100644 --- a/pyreadline/test/emacs_test.py +++ b/pyreadline/test/emacs_test.py @@ -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 diff --git a/pyreadline/test/vi_test.py b/pyreadline/test/vi_test.py index 0728193..cf57c24 100644 --- a/pyreadline/test/vi_test.py +++ b/pyreadline/test/vi_test.py @@ -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):