mirror of
https://github.com/wassname/pyreadline.git
synced 2026-07-02 17:00:47 +08:00
Fix missing function clear_history, thanks to a patch by Aldarion <erendisaldarion@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ from rlmain import *
|
||||
__all__ = [ 'parse_and_bind',
|
||||
'get_line_buffer',
|
||||
'insert_text',
|
||||
'clear_history',
|
||||
'read_init_file',
|
||||
'read_history_file',
|
||||
'write_history_file',
|
||||
|
||||
@@ -53,6 +53,11 @@ class LineHistory(object):
|
||||
history_length=property(get_history_length,set_history_length)
|
||||
history_cursor=property(get_history_cursor,set_history_cursor)
|
||||
|
||||
def clear_history(self):
|
||||
'''Clear readline history.'''
|
||||
self.history[:] = []
|
||||
self.history_cursor = 0
|
||||
|
||||
def read_history_file(self, filename=None):
|
||||
'''Load a readline history file.'''
|
||||
if filename is None:
|
||||
|
||||
@@ -22,7 +22,7 @@ name = 'pyreadline'
|
||||
|
||||
branch = 'refactor'
|
||||
|
||||
version = '1.4'
|
||||
version = '1.4.1'
|
||||
|
||||
revision = '$Revision$'
|
||||
|
||||
|
||||
@@ -170,6 +170,10 @@ class Readline(object):
|
||||
'''
|
||||
self._history.set_history_length(length)
|
||||
|
||||
def clear_history(self):
|
||||
'''Clear readline history'''
|
||||
self._history.clear_history()
|
||||
|
||||
def read_history_file(self, filename=None):
|
||||
'''Load a readline history file. The default filename is ~/.history.'''
|
||||
self._history.read_history_file(filename)
|
||||
@@ -433,6 +437,7 @@ read_init_file = rl.read_init_file
|
||||
add_history = rl.add_history
|
||||
get_history_length = rl.get_history_length
|
||||
set_history_length = rl.set_history_length
|
||||
clear_history = rl.clear_history
|
||||
read_history_file = rl.read_history_file
|
||||
write_history_file = rl.write_history_file
|
||||
set_completer = rl.set_completer
|
||||
|
||||
Reference in New Issue
Block a user