Clear completion model after an item is selected
This commit is contained in:
parent
5d3fe4f506
commit
f59f8cac6c
1
TODO
1
TODO
@ -7,7 +7,6 @@ New config TODO
|
|||||||
Bugs
|
Bugs
|
||||||
====
|
====
|
||||||
|
|
||||||
- Tabbing to a command, then executing it with an error (e.g. :set) keeps the completion position
|
|
||||||
Underlines aren't displayed correctly in completion widget
|
Underlines aren't displayed correctly in completion widget
|
||||||
All kind of FIXMEs
|
All kind of FIXMEs
|
||||||
Weird font rendering
|
Weird font rendering
|
||||||
|
@ -275,6 +275,12 @@ class CompletionView(QTreeView):
|
|||||||
self._ignore_next = True
|
self._ignore_next = True
|
||||||
self.change_completed_part.emit(data)
|
self.change_completed_part.emit(data)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def on_clear_completion_selection(self):
|
||||||
|
"""Clear the selection model when an item is activated."""
|
||||||
|
self.selectionModel().clearSelection()
|
||||||
|
self.selectionModel().clearCurrentIndex()
|
||||||
|
|
||||||
|
|
||||||
class _CompletionItemDelegate(QStyledItemDelegate):
|
class _CompletionItemDelegate(QStyledItemDelegate):
|
||||||
|
|
||||||
|
@ -86,6 +86,8 @@ class MainWindow(QWidget):
|
|||||||
self.tabs.cur_url_changed.connect(self.status.url.set_url)
|
self.tabs.cur_url_changed.connect(self.status.url.set_url)
|
||||||
self.tabs.cur_link_hovered.connect(self.status.url.set_hover_url)
|
self.tabs.cur_link_hovered.connect(self.status.url.set_hover_url)
|
||||||
self.status.cmd.esc_pressed.connect(self.tabs.setFocus)
|
self.status.cmd.esc_pressed.connect(self.tabs.setFocus)
|
||||||
|
self.status.cmd.clear_completion_selection.connect(
|
||||||
|
self.completion.on_clear_completion_selection)
|
||||||
self.status.cmd.hide_completion.connect(self.completion.hide)
|
self.status.cmd.hide_completion.connect(self.completion.hide)
|
||||||
self.status.cmd.textChanged.connect(
|
self.status.cmd.textChanged.connect(
|
||||||
self.completion.on_cmd_text_changed)
|
self.completion.on_cmd_text_changed)
|
||||||
|
@ -227,6 +227,8 @@ class _Command(QLineEdit):
|
|||||||
esc_pressed: Emitted when the escape key was pressed.
|
esc_pressed: Emitted when the escape key was pressed.
|
||||||
tab_pressed: Emitted when the tab key was pressed.
|
tab_pressed: Emitted when the tab key was pressed.
|
||||||
arg: Whether shift has been pressed.
|
arg: Whether shift has been pressed.
|
||||||
|
clear_completion_selection: Emitted before the completion widget is
|
||||||
|
hidden.
|
||||||
hide_completion: Emitted when the completion widget should be hidden.
|
hide_completion: Emitted when the completion widget should be hidden.
|
||||||
show_cmd: Emitted when command input should be shown.
|
show_cmd: Emitted when command input should be shown.
|
||||||
hide_cmd: Emitted when command input can be hidden.
|
hide_cmd: Emitted when command input can be hidden.
|
||||||
@ -239,6 +241,7 @@ class _Command(QLineEdit):
|
|||||||
got_search_rev = pyqtSignal(str)
|
got_search_rev = pyqtSignal(str)
|
||||||
esc_pressed = pyqtSignal()
|
esc_pressed = pyqtSignal()
|
||||||
tab_pressed = pyqtSignal(bool)
|
tab_pressed = pyqtSignal(bool)
|
||||||
|
clear_completion_selection = pyqtSignal()
|
||||||
hide_completion = pyqtSignal()
|
hide_completion = pyqtSignal()
|
||||||
show_cmd = pyqtSignal()
|
show_cmd = pyqtSignal()
|
||||||
hide_cmd = pyqtSignal()
|
hide_cmd = pyqtSignal()
|
||||||
@ -393,6 +396,7 @@ class _Command(QLineEdit):
|
|||||||
e: The QFocusEvent.
|
e: The QFocusEvent.
|
||||||
|
|
||||||
Emit:
|
Emit:
|
||||||
|
clear_completion_selection: Always emitted.
|
||||||
hide_completion: Always emitted so the completion is hidden.
|
hide_completion: Always emitted so the completion is hidden.
|
||||||
"""
|
"""
|
||||||
if e.reason() in [Qt.MouseFocusReason, Qt.TabFocusReason,
|
if e.reason() in [Qt.MouseFocusReason, Qt.TabFocusReason,
|
||||||
@ -400,6 +404,7 @@ class _Command(QLineEdit):
|
|||||||
self.setText('')
|
self.setText('')
|
||||||
self._histbrowse_stop()
|
self._histbrowse_stop()
|
||||||
self.hide_cmd.emit()
|
self.hide_cmd.emit()
|
||||||
|
self.clear_completion_selection.emit()
|
||||||
self.hide_completion.emit()
|
self.hide_completion.emit()
|
||||||
super().focusOutEvent(e)
|
super().focusOutEvent(e)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user