Skip to content

Commit

Permalink
User commands are now auto-completed to the selected command
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastProject committed Mar 22, 2017
1 parent ccf1964 commit 79b8dbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed
- Give more information upon installing modules and warn the user that they are code
- User commands will now be auto-completed to the selected command

### Fixed
- Files unexpectedly existing in ~/.config/pext/modules/ no longer causes a crash
Expand Down
8 changes: 8 additions & 0 deletions pext/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,15 @@ def select(self) -> None:
current_index = QQmlProperty.read(self.result_list_model, "currentIndex")

if self.result_list_model_command_mode or len(self.filtered_entry_list) == 0:
selected_command = self.filtered_command_list[current_index - len(self.filtered_entry_list)]
selected_command_split = selected_command.split(" ", 1)
command_typed = QQmlProperty.read(self.search_input_model, "text")
command_typed_split = command_typed.split(" ", 1)

try:
command_typed = selected_command_split[0] + " " + command_typed_split[1]
except IndexError:
command_typed = selected_command_split[0]

self.selection.append(
{'type': SelectionType.command, 'value': command_typed})
Expand Down

0 comments on commit 79b8dbb

Please sign in to comment.