mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
only show rightmost completion in nested attrs
only prompt_toolkit so far
This commit is contained in:
parent
7a689bbbcb
commit
d47ac71e6b
2 changed files with 4 additions and 1 deletions
|
@ -106,7 +106,8 @@ def attr_complete(prefix, ctx, filter_func):
|
|||
rpl = opt
|
||||
# note that prefix[:prelen-len(attr)] != prefix[:-len(attr)]
|
||||
# when len(attr) == 0.
|
||||
comp = prefix[:prelen - len(attr)] + rpl
|
||||
# comp = prefix[:prelen - len(attr)] + rpl
|
||||
comp = rpl
|
||||
attrs.add(comp)
|
||||
return attrs
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ class PromptToolkitCompleter(Completer):
|
|||
elif len(os.path.commonprefix(completions)) <= len(prefix):
|
||||
self.reserve_space()
|
||||
for comp in completions:
|
||||
prefix = prefix.rsplit('.', 1)[-1]
|
||||
l = len(prefix) if prefix in comp else 0
|
||||
yield Completion(comp, -l)
|
||||
|
||||
def reserve_space(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue