Skip to content

Commit

Permalink
Focus changes, which also fixes blinking caret
Browse files Browse the repository at this point in the history
- add Qt::NoFocus QListWidget of autocomplete (to prevent focus)
- and force the focus on the TextEditorWidget after opening the popup (fix caret)

The focus-lost on the TextEditorWidget was triggerable by pressing
the up-arrow in the first element in the list
  • Loading branch information
gamecreature committed May 30, 2023
1 parent afa6e44 commit 6589205
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edbee.lib:
- fix, Autocomplete Improvements
- autocomplete is now really canceled with the escape key. It only appears again if the word becomes blank
- add Qt::NoFocus focus policy to TextEditorAutocompleteComponent, to hopefully solve focus issue (https://github.com/Mudlet/Mudlet/issues/5310)
- add Qt::NoFocus focus policy to QListWidget of autocomplete, and force the focus on the TextEditorWidget after opening the popup
- fix #140, Fix Array index out of bounds assertion loading with TextDocumentSerializer
- fix #136, BREAKING CHANGE: return type TextEditorController::executeCommand changed to void.
- changed TextEditorController slot arguments to fully-qualified types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ TextEditorAutoCompleteComponent::TextEditorAutoCompleteComponent(TextEditorContr

menuRef_ = new QMenu(this);
listWidgetRef_ = new QListWidget(menuRef_);
listWidgetRef_->setFocusPolicy(Qt::NoFocus);
listWidgetRef_->installEventFilter(this);
menuRef_->installEventFilter(this);
menuRef_->setStyleSheet("QMenu { border: 1px solid black; }");
Expand Down Expand Up @@ -404,6 +405,8 @@ void TextEditorAutoCompleteComponent::updateList()
if( fillAutoCompleteList(doc, range, currentWord_)) {
menuRef_->popup(menuRef_->pos());

editorComponentRef_->setFocus();

// position the widget
showInfoTip();
} else {
Expand Down

0 comments on commit 6589205

Please sign in to comment.