summary refs log tree commit diff
path: root/src/TextInputWidget.h
diff options
context:
space:
mode:
authorJussi Kuokkanen <jussi.kuokkanen@protonmail.com>2020-08-28 23:59:27 +0300
committerJussi Kuokkanen <jussi.kuokkanen@protonmail.com>2020-08-28 23:59:27 +0300
commit7acd4b3307fafd986b7dd7c6f29403038b8f3604 (patch)
tree562a0df4d2feb9987be05f1a4e74d5880bf0cfe2 /src/TextInputWidget.h
parentMerge branch 'master' of https://github.com/Nheko-Reborn/nheko (diff)
downloadnheko-7acd4b3307fafd986b7dd7c6f29403038b8f3604.tar.xz
lint
Diffstat (limited to 'src/TextInputWidget.h')
-rw-r--r--src/TextInputWidget.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h

index 8cd61b6a..4ae68798 100644 --- a/src/TextInputWidget.h +++ b/src/TextInputWidget.h
@@ -109,7 +109,7 @@ private: { return pos == atTriggerPosition_ + anchorWidth(anchor); } - QRect completerRect(); + QRect completerRect(); QString query() { auto cursor = textCursor(); @@ -118,18 +118,18 @@ private: } QString wordUnderCursor() { - auto tc = textCursor(); - auto editor_text = toPlainText(); - // Text before cursor - auto text = editor_text.chopped(editor_text.length() - tc.position()); - // Revert to find the first space (last before cursor in the original) - std::reverse(text.begin(), text.end()); - auto space_idx = text.indexOf(" "); - if (space_idx > -1) - text.chop(text.length() - space_idx); - // Revert back - std::reverse(text.begin(), text.end()); - return text; + auto tc = textCursor(); + auto editor_text = toPlainText(); + // Text before cursor + auto text = editor_text.chopped(editor_text.length() - tc.position()); + // Revert to find the first space (last before cursor in the original) + std::reverse(text.begin(), text.end()); + auto space_idx = text.indexOf(" "); + if (space_idx > -1) + text.chop(text.length() - space_idx); + // Revert back + std::reverse(text.begin(), text.end()); + return text; } dialogs::PreviewUploadOverlay previewDialog_; @@ -137,7 +137,7 @@ private: //! Latest position of the '@' character that triggers the username completer. int atTriggerPosition_ = -1; - void insertCompletion(QString completion); + void insertCompletion(QString completion); void textChanged(); void uploadData(const QByteArray data, const QString &media, const QString &filename); void afterCompletion(int);