From 67a74b2d09631f4e44dc1e0f7b5a20f6f140449f Mon Sep 17 00:00:00 2001 From: moculus Date: Wed, 21 May 2008 20:52:13 +0000 Subject: [PATCH] bug fix for console and tab improvements --HG-- branch : pmacs2 --- mode/consolemini.py | 18 +++++++++++------- mode/iperlmini.py | 3 +-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mode/consolemini.py b/mode/consolemini.py index b4fd92c..7539ffe 100644 --- a/mode/consolemini.py +++ b/mode/consolemini.py @@ -136,8 +136,14 @@ class ConsoleTab(method.Method): first_t = curr_t j = curr_i - names = [curr_t.string] name_re = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*$') + if name_re.match(curr_t.string): + names = [curr_t.string] + elif curr_t.string == '.': + names = [''] + else: + names = [] + while j >= 1: j -= 1 t = tokens[j] @@ -177,12 +183,10 @@ class ConsoleTab(method.Method): newnames.update(w.mode.locals) newnames.update(w.mode.globals) candidates = [x for x in newnames if x.startswith(name)] - if len(candidates) > 1: - s = completer.find_common_string(candidates)[len(name):] - w.insert_string_at_cursor(s) - elif len(candidates) == 1: - s = candidates[0][len(name):] - w.insert_string_at_cursor(s) + + s = completer.find_common_string(candidates)[len(name):] + w.insert_string_at_cursor(s) + mode.mini.use_completion_window(a, name, candidates) class ConsoleBaseMethod(method.Method): subcls = method.Method diff --git a/mode/iperlmini.py b/mode/iperlmini.py index 1859826..571b17b 100644 --- a/mode/iperlmini.py +++ b/mode/iperlmini.py @@ -57,10 +57,9 @@ class IperlTab(method.Method): if candidates: s = completer.find_common_string(candidates) - #w.buffer.delete(Point(t.x, 0), Point(t.end_x(), 0), force=True) w.buffer.delete(Point(x1, 0), Point(x2, 0), force=True) w.insert_string_at_cursor(s) - mode.mini.use_completion_window(a, s, candidates) + mode.mini.use_completion_window(a, s, candidates) class IperlStart(method.Method): '''Evaluate python expressions (for advanced use and debugging only)'''