Merging from r92 1.6

This commit is contained in:
Jorgen Stenarson
2011-02-25 20:19:13 +01:00
4 changed files with 30 additions and 1 deletions
-1
View File
@@ -9,4 +9,3 @@
import unicode_helper, logger, clipboard, lineeditor, modes, console
from rlmain import *
import rlmain
import release
+16
View File
@@ -33,11 +33,27 @@ class LineHistory(object):
self.lastcommand = None
self.query = u""
def get_current_history_length(self):
u'''Return the number of lines currently in the history.
(This is different from get_history_length(), which returns
the maximum number of lines that will be written to a history file.)'''
value = len(self.history)
log(u"get_current_history_length:%d"%value)
return value
def get_history_length(self):
u'''Return the desired length of the history file. Negative values imply
unlimited history file size.'''
value = self._history_length
log(u"get_history_length:%d"%value)
return value
def get_history_item(self, index):
u'''Return the current contents of history item at index.'''
item = self.history[index]
log(u"get_history_item: index:%d item:%r"%(index, item))
return item.get_line_text()
def set_history_length(self, value):
log(u"set_history_length: old:%d new:%d"%(self._history_length, value))
self._history_length = value
+10
View File
@@ -128,6 +128,12 @@ class BaseReadline(object):
u'''Append a line to the history buffer, as if it was the last line typed.'''
self.mode._history.add_history(line)
def get_current_history_length(self ):
u'''Return the number of lines currently in the history.
(This is different from get_history_length(), which returns
the maximum number of lines that will be written to a history file.)'''
return self.mode._history.get_current_history_length()
def get_history_length(self ):
u'''Return the desired length of the history file.
@@ -142,6 +148,10 @@ class BaseReadline(object):
'''
self.mode._history.set_history_length(length)
def get_history_item(self, index):
u'''Return the current contents of history item at index.'''
return self.mode._history.get_history_item(index)
def clear_history(self):
u'''Clear readline history'''
self.mode._history.clear_history()
+4
View File
@@ -11,7 +11,9 @@ __all__ = [ 'parse_and_bind',
'read_init_file',
'read_history_file',
'write_history_file',
'get_current_history_length',
'get_history_length',
'get_history_item',
'set_history_length',
'set_startup_hook',
'set_pre_input_hook',
@@ -54,7 +56,9 @@ else:
read_history_file = rl.read_history_file
get_completer_delims = rl.get_completer_delims
get_current_history_length = rl.get_current_history_length
get_history_length = rl.get_history_length
get_history_item = rl.get_history_item
get_line_buffer = rl.get_line_buffer
set_completer = rl.set_completer
get_completer = rl.get_completer