bug fix for console and tab improvements

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-05-21 20:52:13 +00:00
parent fc501131fd
commit 67a74b2d09
2 changed files with 12 additions and 9 deletions

View File

@ -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

View File

@ -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)'''