fixed string.letters locale bug

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-06-13 21:46:38 -04:00
parent 1d1f26e8c2
commit 479e95bc92
10 changed files with 12 additions and 11 deletions

View File

@ -132,7 +132,7 @@ class Application(object):
exec("import mode.%s; mode.%s.install(self)" % (name, name)) exec("import mode.%s; mode.%s.install(self)" % (name, name))
# create all the insert methods for the character ranges we like # create all the insert methods for the character ranges we like
for c in string.letters + string.digits + string.punctuation: for c in string.ascii_letters + string.digits + string.punctuation:
obj = method.InsertString(c) obj = method.InsertString(c)
self.methods[obj.name] = obj self.methods[obj.name] = obj
obj = method.OverwriteChar(c) obj = method.OverwriteChar(c)
@ -207,7 +207,7 @@ class Application(object):
self.config['error_timeout'] = -1 self.config['error_timeout'] = -1
self.config['max_error_len'] = 192 self.config['max_error_len'] = 192
self.config['max_num_kills'] = 64 self.config['max_num_kills'] = 64
self.config['word_letters'] = string.letters + string.digits self.config['word_letters'] = string.ascii_letters + string.digits
self.config['default_color'] = ('default', 'default',) self.config['default_color'] = ('default', 'default',)
self.config['margin'] = 80 self.config['margin'] = 80
self.config['margin_color'] = 'blue' self.config['margin_color'] = 'blue'

View File

@ -268,7 +268,7 @@ class Fundamental(Handler):
self.word_letters = w.application.config['word_letters'] self.word_letters = w.application.config['word_letters']
# create all the insert actions for the basic text input # create all the insert actions for the basic text input
for c in string.letters + string.digits + string.punctuation: for c in string.ascii_letters + string.digits + string.punctuation:
self.add_binding('insert-string-%s' % c, c) self.add_binding('insert-string-%s' % c, c)
# per-mode bindings # per-mode bindings

View File

@ -234,7 +234,7 @@ class Hex(Fundamental):
cgreen = color.build('green', 'default', 'bold') cgreen = color.build('green', 'default', 'bold')
ccyan = color.build('cyan', 'default', 'bold') ccyan = color.build('cyan', 'default', 'bold')
ccursor = color.build('default', 'default', 'bold', 'reverse') ccursor = color.build('default', 'default', 'bold', 'reverse')
for c in string.letters + string.digits + string.punctuation + ' ': for c in string.ascii_letters + string.digits + string.punctuation + ' ':
_ctrans[ord(c)] = c _ctrans[ord(c)] = c
ctrans = ''.join(_ctrans) ctrans = ''.join(_ctrans)
actions = [HexForward, HexBackward, HexForwardWord, HexBackwardWord, actions = [HexForward, HexBackward, HexForwardWord, HexBackwardWord,
@ -363,7 +363,7 @@ class Hex(Fundamental):
self.add_bindings('goto-address', ('C-c M-g',)) self.add_bindings('goto-address', ('C-c M-g',))
# create all the insert actions for the basic text input # create all the insert actions for the basic text input
for c in string.letters + string.digits + string.punctuation: for c in string.ascii_letters + string.digits + string.punctuation:
self.add_action_and_bindings(HexOverwriteChar(c), (c,)) self.add_action_and_bindings(HexOverwriteChar(c), (c,))
self.add_bindings('hex-overwrite-char-space', ('SPACE',)) self.add_bindings('hex-overwrite-char-space', ('SPACE',))
self.add_bindings('hex-overwrite-char-tab', ('TAB',)) self.add_bindings('hex-overwrite-char-tab', ('TAB',))

View File

@ -66,7 +66,7 @@ class InsertMini(Fundamental):
self.add_bindings('mini-insert-complete', ('M-RETURN',)) self.add_bindings('mini-insert-complete', ('M-RETURN',))
self.add_bindings('mini-insert-cancel', ('C-]', 'C-g')) self.add_bindings('mini-insert-cancel', ('C-]', 'C-g'))
self.add_bindings('mini-insert-tab', ('TAB',)) self.add_bindings('mini-insert-tab', ('TAB',))
for c in string.letters + string.digits + string.punctuation: for c in string.ascii_letters + string.digits + string.punctuation:
self.add_binding('insert-string-%s' % c, c) self.add_binding('insert-string-%s' % c, c)
install = InsertMini.install install = InsertMini.install

View File

@ -142,7 +142,7 @@ class IperlMini(Fundamental):
self.add_bindings('iperl-page-down', ('C-v',)) self.add_bindings('iperl-page-down', ('C-v',))
self.add_bindings('iperl-goto-beginning', ('M-<',)) self.add_bindings('iperl-goto-beginning', ('M-<',))
self.add_bindings('iperl-goto-end', ('M->',)) self.add_bindings('iperl-goto-end', ('M->',))
for c in string.letters + string.digits + string.punctuation: for c in string.ascii_letters + string.digits + string.punctuation:
self.add_binding('insert-string-%s' % c, c) self.add_binding('insert-string-%s' % c, c)
install = IperlMini.install install = IperlMini.install

View File

@ -114,7 +114,7 @@ class IpythonMini(mode.Fundamental):
self.add_bindings('ipython-page-down', ('C-v',)) self.add_bindings('ipython-page-down', ('C-v',))
self.add_bindings('ipython-goto-beginning', ('M-<',)) self.add_bindings('ipython-goto-beginning', ('M-<',))
self.add_bindings('ipython-goto-end', ('M->',)) self.add_bindings('ipython-goto-end', ('M->',))
for c in string.letters + string.digits + string.punctuation: for c in string.ascii_letters + string.digits + string.punctuation:
self.add_binding('insert-string-%s' % c, c) self.add_binding('insert-string-%s' % c, c)
install = IpythonMini.install install = IpythonMini.install

View File

@ -619,7 +619,7 @@ class PerlOpenModule(Method):
else: else:
w.set_error("Could not find module %r" % vargs['module']) w.set_error("Could not find module %r" % vargs['module'])
class PerlOpenModuleWord(Method): class PerlOpenModuleWord(Method):
namechars = string.letters + string.digits + '_' namechars = string.ascii_letters + string.digits + '_'
def _execute(self, w, **vargs): def _execute(self, w, **vargs):
word = pkg = w.get_token().string word = pkg = w.get_token().string
path = None path = None

View File

@ -139,7 +139,7 @@ class Search(Fundamental):
self.add_bindings('search-delete-left-word', ('M-DELETE', 'M-BACKSPACE',)) self.add_bindings('search-delete-left-word', ('M-DELETE', 'M-BACKSPACE',))
# create all the insert actions for the character ranges we like # create all the insert actions for the character ranges we like
for collection in (string.letters, string.digits, string.punctuation): for collection in (string.ascii_letters, string.digits, string.punctuation):
for c in collection: for c in collection:
self.add_action_and_bindings(InsertSearchString(c), (c,)) self.add_action_and_bindings(InsertSearchString(c), (c,))
self.add_action_and_bindings(InsertSearchString(' '), ('SPACE',)) self.add_action_and_bindings(InsertSearchString(' '), ('SPACE',))

View File

@ -5,7 +5,7 @@ from point import Point
# entry. otherwise this project is probably hopeless. # entry. otherwise this project is probably hopeless.
def show(c): def show(c):
if c in string.letters + string.digits + string.punctuation + ' ': if c in string.ascii_letters + string.digits + string.punctuation + ' ':
return c return c
else: else:
return '\\%03o' % ord(c) return '\\%03o' % ord(c)

View File

@ -325,6 +325,7 @@ class Window(object):
x = len(self.buffer.lines[y]) x = len(self.buffer.lines[y])
else: else:
x -= 1 x -= 1
found_word = False found_word = False
while (y, x) >= start and self.xy_char(x, y) in self.mode.word_letters: while (y, x) >= start and self.xy_char(x, y) in self.mode.word_letters:
found_word = True found_word = True