Skip to content

Commit

Permalink
Merge remote-tracking branch 'gh/moorchegue/next_completion' into next
Browse files Browse the repository at this point in the history
* gh/moorchegue/next_completion:
  Completion for `set` command is not the special case anymore since it lost `=` sign.
  Tiny fix.
  • Loading branch information
mathstuf committed Apr 27, 2015
2 parents 191989c + b6dafd3 commit 33c9177
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions uzbl/plugins/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def get_incomplete_keyword(self):
left_segment = keylet.keycmd[:keylet.cursor]
partial = (FIND_SEGMENT(left_segment) + ['', ])[0].lstrip()
if partial.startswith('set '):
return ('@' + partial[4:].lstrip(), True)
return '@' + partial[4:].lstrip()

return (partial, False)
return partial

def stop_completion(self, *args):
'''Stop command completion and return the level to NONE.'''
Expand All @@ -86,16 +86,11 @@ def stop_completion(self, *args):
if 'completion_list' in Config[self.uzbl]:
del Config[self.uzbl]['completion_list']

def complete_completion(self, partial, hint, set_completion=False):
def complete_completion(self, partial, hint):
'''Inject the remaining porition of the keyword into the keycmd then stop
the completioning.'''

if set_completion:
remainder = "%s = " % hint[len(partial):]

else:
remainder = "%s " % hint[len(partial):]

remainder = "{} ".format(hint[len(partial):])
KeyCmd[self.uzbl].inject_keycmd(remainder)
self.stop_completion()

Expand All @@ -109,7 +104,7 @@ def update_completion_list(self, *args):
'''Checks if the user still has a partially completed keyword under his
cursor then update the completion hints list.'''

partial = self.get_incomplete_keyword()[0]
partial = self.get_incomplete_keyword()
if not partial:
return self.stop_completion()

Expand All @@ -129,7 +124,7 @@ def start_completion(self, *args):
if self.completion.locked:
return

(partial, set_completion) = self.get_incomplete_keyword()
partial = self.get_incomplete_keyword()
if not partial:
return self.stop_completion()

Expand All @@ -142,13 +137,13 @@ def start_completion(self, *args):

elif len(hints) == 1:
self.completion.lock()
self.complete_completion(partial, hints[0], set_completion)
self.complete_completion(partial, hints[0])
self.completion.unlock()
return

elif partial in hints and completion.level == COMPLETE:
elif partial in hints and self.completion.level == COMPLETE:
self.completion.lock()
self.complete_completion(partial, partial, set_completion)
self.complete_completion(partial, partial)
self.completion.unlock()
return

Expand Down

0 comments on commit 33c9177

Please sign in to comment.