Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

Commit

Permalink
Properly reset the autocomplete anchor when the popup closes
Browse files Browse the repository at this point in the history
fixes #305
  • Loading branch information
mujx committed Jul 15, 2018
1 parent fde066e commit 21185a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/SuggestionsPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <QPainter>
#include <QStyleOption>

constexpr int PopupHMargin = 5;
constexpr int PopupItemMargin = 4;
constexpr int PopupHMargin = 4;
constexpr int PopupItemMargin = 3;

PopupItem::PopupItem(QWidget *parent)
: QWidget(parent)
Expand All @@ -23,6 +23,8 @@ PopupItem::PopupItem(QWidget *parent)
topLayout_ = new QHBoxLayout(this);
topLayout_->setContentsMargins(
PopupHMargin, PopupItemMargin, PopupHMargin, PopupItemMargin);

setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
}

void
Expand Down
2 changes: 2 additions & 0 deletions src/TextInputWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
auto word = cursor.selectedText();

if (cursor.position() == 0) {
resetAnchor();
closeSuggestions();
return;
}
Expand All @@ -231,6 +232,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)

emit showSuggestions(query());
} else {
resetAnchor();
closeSuggestions();
}

Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/PreviewUploadOverlay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ PreviewUploadOverlay::init()
winsize = window->frameGeometry().size();
center = window->frameGeometry().center();
} else {
nhlog::ui()->warn("unable to load the retrieve MainWindow's size");
nhlog::ui()->warn("unable to retrieve MainWindow's size");
}

fileName_.setText(QFileInfo{filePath_}.fileName());
Expand Down

0 comments on commit 21185a4

Please sign in to comment.