diff --git a/application.py b/application.py index 1835657..c3b50e7 100755 --- a/application.py +++ b/application.py @@ -132,7 +132,7 @@ class Application(object): exec("import mode.%s; mode.%s.install(self)" % (name, name)) # 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) self.methods[obj.name] = obj obj = method.OverwriteChar(c) @@ -207,7 +207,7 @@ class Application(object): self.config['error_timeout'] = -1 self.config['max_error_len'] = 192 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['margin'] = 80 self.config['margin_color'] = 'blue' diff --git a/mode/__init__.py b/mode/__init__.py index e2033c4..f21eb1c 100644 --- a/mode/__init__.py +++ b/mode/__init__.py @@ -268,7 +268,7 @@ class Fundamental(Handler): self.word_letters = w.application.config['word_letters'] # 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) # per-mode bindings diff --git a/mode/hex.py b/mode/hex.py index 6065349..a342137 100644 --- a/mode/hex.py +++ b/mode/hex.py @@ -234,7 +234,7 @@ class Hex(Fundamental): cgreen = color.build('green', 'default', 'bold') ccyan = color.build('cyan', 'default', 'bold') 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 = ''.join(_ctrans) actions = [HexForward, HexBackward, HexForwardWord, HexBackwardWord, @@ -363,7 +363,7 @@ class Hex(Fundamental): self.add_bindings('goto-address', ('C-c M-g',)) # 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_bindings('hex-overwrite-char-space', ('SPACE',)) self.add_bindings('hex-overwrite-char-tab', ('TAB',)) diff --git a/mode/insertmini.py b/mode/insertmini.py index b2818dc..3dec1d3 100644 --- a/mode/insertmini.py +++ b/mode/insertmini.py @@ -66,7 +66,7 @@ class InsertMini(Fundamental): self.add_bindings('mini-insert-complete', ('M-RETURN',)) self.add_bindings('mini-insert-cancel', ('C-]', 'C-g')) 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) install = InsertMini.install diff --git a/mode/iperlmini.py b/mode/iperlmini.py index 2284e09..fe62c17 100644 --- a/mode/iperlmini.py +++ b/mode/iperlmini.py @@ -142,7 +142,7 @@ class IperlMini(Fundamental): self.add_bindings('iperl-page-down', ('C-v',)) self.add_bindings('iperl-goto-beginning', ('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) install = IperlMini.install diff --git a/mode/ipythonmini.py b/mode/ipythonmini.py index 2247d75..14fcc8e 100644 --- a/mode/ipythonmini.py +++ b/mode/ipythonmini.py @@ -114,7 +114,7 @@ class IpythonMini(mode.Fundamental): self.add_bindings('ipython-page-down', ('C-v',)) self.add_bindings('ipython-goto-beginning', ('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) install = IpythonMini.install diff --git a/mode/perl.py b/mode/perl.py index 02457bc..3fb07c7 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -619,7 +619,7 @@ class PerlOpenModule(Method): else: w.set_error("Could not find module %r" % vargs['module']) class PerlOpenModuleWord(Method): - namechars = string.letters + string.digits + '_' + namechars = string.ascii_letters + string.digits + '_' def _execute(self, w, **vargs): word = pkg = w.get_token().string path = None diff --git a/mode/search.py b/mode/search.py index bc1acf9..8298a28 100644 --- a/mode/search.py +++ b/mode/search.py @@ -139,7 +139,7 @@ class Search(Fundamental): self.add_bindings('search-delete-left-word', ('M-DELETE', 'M-BACKSPACE',)) # 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: self.add_action_and_bindings(InsertSearchString(c), (c,)) self.add_action_and_bindings(InsertSearchString(' '), ('SPACE',)) diff --git a/term.py b/term.py index cd43a4c..dfa4fdf 100644 --- a/term.py +++ b/term.py @@ -5,7 +5,7 @@ from point import Point # entry. otherwise this project is probably hopeless. def show(c): - if c in string.letters + string.digits + string.punctuation + ' ': + if c in string.ascii_letters + string.digits + string.punctuation + ' ': return c else: return '\\%03o' % ord(c) diff --git a/window.py b/window.py index f6a11d3..b48f381 100644 --- a/window.py +++ b/window.py @@ -325,6 +325,7 @@ class Window(object): x = len(self.buffer.lines[y]) else: x -= 1 + found_word = False while (y, x) >= start and self.xy_char(x, y) in self.mode.word_letters: found_word = True