mirror of
https://github.com/wassname/pyreadline.git
synced 2026-06-27 16:10:38 +08:00
Handle non-ascii for history and ini filenames
This commit is contained in:
committed by
Jrgen Stenarson
parent
d7fc18bf5f
commit
9fcaa48cbe
@@ -27,7 +27,7 @@ class LineHistory(object):
|
||||
self.history = []
|
||||
self._history_length = 100
|
||||
self._history_cursor = 0
|
||||
self.history_filename = os.path.expanduser('~/.history') #Cannot expand unicode strings correctly on python2.4
|
||||
self.history_filename = os.path.expanduser(ensure_str('~/.history')) #Cannot expand unicode strings correctly on python2.4
|
||||
self.lastcommand = None
|
||||
self.query = ""
|
||||
self.last_search_for = ""
|
||||
|
||||
@@ -21,7 +21,7 @@ import pyreadline.console as console
|
||||
import pyreadline.logger as logger
|
||||
|
||||
from pyreadline.keysyms.common import make_KeyPress_from_keydescr
|
||||
from pyreadline.unicode_helper import ensure_unicode
|
||||
from pyreadline.unicode_helper import ensure_unicode, ensure_str
|
||||
from .logger import log
|
||||
from .modes import editingmodes
|
||||
from .error import ReadlineError, GetSetError
|
||||
@@ -278,7 +278,7 @@ class BaseReadline(object):
|
||||
self.callback(line)
|
||||
|
||||
def read_inputrc(self, #in 2.4 we cannot call expanduser with unicode string
|
||||
inputrcpath=os.path.expanduser("~/pyreadlineconfig.ini")):
|
||||
inputrcpath=os.path.expanduser(ensure_str("~/pyreadlineconfig.ini"))):
|
||||
modes = dict([(x.mode,x) for x in self.editingmodes])
|
||||
mode = self.editingmodes[0].mode
|
||||
|
||||
@@ -312,7 +312,7 @@ class BaseReadline(object):
|
||||
pyreadline.lineeditor.lineobj.kill_ring_to_clipboard = killring
|
||||
|
||||
def sethistoryfilename(filename):
|
||||
self.mode._history.history_filename=os.path.expanduser(filename)
|
||||
self.mode._history.history_filename = os.path.expanduser(ensure_str(filename))
|
||||
|
||||
def setbellstyle(mode):
|
||||
self.bell_style = mode
|
||||
|
||||
Reference in New Issue
Block a user