summaryrefslogtreecommitdiff
path: root/alot/completion
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2019-08-17 10:25:39 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2019-08-17 11:10:37 +0100
commit0f4fbc8886cb3571828083cce27e8fd88bc7d220 (patch)
tree49f3d8b194891c76ca764085c9b163ae6801b101 /alot/completion
parentfada7a9a40300060dde1b09c93394a790e899795 (diff)
make codeclimate happy(er)
Diffstat (limited to 'alot/completion')
-rw-r--r--alot/completion/command.py11
-rw-r--r--alot/completion/commandline.py10
-rw-r--r--alot/completion/multipleselection.py2
3 files changed, 12 insertions, 11 deletions
diff --git a/alot/completion/command.py b/alot/completion/command.py
index 305e445f..2ba6d541 100644
--- a/alot/completion/command.py
+++ b/alot/completion/command.py
@@ -69,19 +69,20 @@ class CommandCompleter(Completer):
def _publickeyscompleter(self):
return CryptoKeyCompleter(private=False)
- def complete(self, line, pos):
+ def complete(self, original, pos):
# remember how many preceding space characters we see until the command
# string starts. We'll continue to complete from there on and will add
# these whitespaces again at the very end
- whitespaceoffset = len(line) - len(line.lstrip())
- line = line[whitespaceoffset:]
+ whitespaceoffset = len(original) - len(original.lstrip())
+ original = original[whitespaceoffset:]
pos = pos - whitespaceoffset
- words = line.split(' ', 1)
+ words = original.split(' ', 1)
res = []
if pos <= len(words[0]): # we complete commands
- for cmd, cpos in self._commandnamecompleter.complete(line, pos):
+ for cmd, cpos in self._commandnamecompleter.complete(original,
+ pos):
newtext = ('%s %s' % (cmd, ' '.join(words[1:])))
res.append((newtext, cpos + 1))
else:
diff --git a/alot/completion/commandline.py b/alot/completion/commandline.py
index f5739f38..0092c8e7 100644
--- a/alot/completion/commandline.py
+++ b/alot/completion/commandline.py
@@ -39,11 +39,11 @@ class CommandLineCompleter(Completer):
end += 1 + len(commands[i])
return start, end
- def complete(self, line, pos):
- cstart, cend = self.get_context(line, pos)
- before = line[:cstart]
- after = line[cend:]
- cmdstring = line[cstart:cend]
+ def complete(self, original, pos):
+ cstart, cend = self.get_context(original, pos)
+ before = original[:cstart]
+ after = original[cend:]
+ cmdstring = original[cstart:cend]
cpos = pos - cstart
res = []
diff --git a/alot/completion/multipleselection.py b/alot/completion/multipleselection.py
index 45de5a28..8ceb9ed6 100644
--- a/alot/completion/multipleselection.py
+++ b/alot/completion/multipleselection.py
@@ -25,7 +25,7 @@ class MultipleSelectionCompleter(Completer):
self._completer = completer
self._separator = separator
- def relevant_part(self, original, pos):
+ def relevant_part(self, original, pos, sep=' '):
"""Calculate the subword of `original` that `pos` is in."""
start = original.rfind(self._separator, 0, pos)
if start == -1: