summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tabs.py10
-rw-r--r--src/windows.py6
2 files changed, 11 insertions, 5 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 1b6aeb7c..fbcfc597 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -125,7 +125,13 @@ class Tab(object):
# complete the command's name
words = ['/%s'% (name) for name in self.core.commands] +\
['/%s' % (name) for name in self.commands]
- the_input.auto_completion(words, ' ')
+ the_input.auto_completion(words, '')
+ # Do not try to cycle command completion if there was only
+ # one possibily. The next tab will complete the argument.
+ # Otherwise we would need to add a useless space before being
+ # able to complete the arguments.
+ if len(the_input.hit_list) == 1:
+ the_input.do_command(' ')
return True
return False
@@ -600,7 +606,7 @@ class MucTab(ChatTab):
def completion_topic(self, the_input):
current_topic = self.get_room().topic
- return the_input.auto_completion([current_topic], ' ')
+ return the_input.auto_completion([current_topic], '')
def command_kick(self, arg):
"""
diff --git a/src/windows.py b/src/windows.py
index 03066857..fb99416c 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -122,7 +122,6 @@ class Win(object):
self.move(y, x)
next_attr_char = text.find('\x19')
while next_attr_char != -1 and text:
- log.debug('Addstr_Colored: [%s]' % text.replace('\x19', '\\x19'))
if next_attr_char + 1 < len(text):
attr_char = text[next_attr_char+1].lower()
else:
@@ -961,7 +960,7 @@ class Input(Win):
if pos < len(self.text) and after.endswith(' ') and self.text[pos] == ' ':
after = after[:-1] # remove the last space if we are already on a space
if not self.last_completion:
- space_before_cursor = self.text.rfind(' ', 0, pos-1)
+ space_before_cursor = self.text.rfind(' ', 0, pos)
if space_before_cursor != -1:
begin = self.text[space_before_cursor+1:pos]
else:
@@ -1043,7 +1042,8 @@ class Input(Win):
return res
if not key or len(key) > 1:
return False # ignore non-handled keyboard shortcuts
- self.reset_completion()
+ if reset:
+ self.reset_completion()
self.text = self.text[:self.pos+self.line_pos]+key+self.text[self.pos+self.line_pos:]
(y, x) = self._win.getyx()
if x == self.width-1: