Skip to content

Commit

Permalink
start autocompletion for non-command keys at the 3rd character
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Beer committed Aug 7, 2017
1 parent 2dec408 commit 6a6070a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changes for crash
Unreleased
==========

- Start autocompletion for non-command keys at the 3rd character.

2017/07/24 0.21.4
=================

Expand Down
9 changes: 5 additions & 4 deletions src/crate/crash/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@ def get_completions(self, document, complete_event):
for w in self.get_command_completions(line):
yield Completion(w, -len(word_before_cursor))
return
for keyword in self.keywords:
if keyword.startswith(word_before_cursor.lower()):
yield Completion(keyword.upper(), -len(word_before_cursor))

# start autocomplete on 3rd character for non-command keys
if len(word_before_cursor) >= 3:
for keyword in self.keywords:
if keyword.startswith(word_before_cursor.lower()):
yield Completion(keyword.upper(), -len(word_before_cursor))

class CrashBuffer(Buffer):

Expand Down

0 comments on commit 6a6070a

Please sign in to comment.