summary refs log tree commit diff
path: root/src/TextInputWidget.h
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-09-03 18:11:17 +0000
committerGitHub <noreply@github.com>2020-09-03 18:11:17 +0000
commit657f4073e98176dab3de85a3868ed633d8544ede (patch)
tree5614ee224aa8acb0fa492a154f7e456ad4d33990 /src/TextInputWidget.h
parentAdd support for Encrypted to-device verification messages (diff)
parentFix endless pagination, when old history is inaccessible (diff)
downloadnheko-657f4073e98176dab3de85a3868ed633d8544ede.tar.xz
Merge branch 'master' into device-verification
Diffstat (limited to 'src/TextInputWidget.h')
-rw-r--r--src/TextInputWidget.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h
index 2473c13a..3aa05c39 100644
--- a/src/TextInputWidget.h
+++ b/src/TextInputWidget.h
@@ -33,8 +33,10 @@
 
 struct SearchResult;
 
+class CompletionModel;
 class FlatButton;
 class LoadingIndicator;
+class QCompleter;
 
 class FilteredTextEdit : public QTextEdit
 {
@@ -80,8 +82,12 @@ protected:
         }
 
 private:
+        bool emoji_popup_open_ = false;
+        CompletionModel *emoji_completion_model_;
         std::deque<QString> true_history_, working_history_;
+        int trigger_pos_; // Where emoji completer was triggered
         size_t history_index_;
+        QCompleter *completer_;
         QTimer *typingTimer_;
 
         SuggestionsPopup suggestionsPopup_;
@@ -103,19 +109,27 @@ private:
         {
                 return pos == atTriggerPosition_ + anchorWidth(anchor);
         }
-
+        QRect completerRect();
         QString query()
         {
                 auto cursor = textCursor();
                 cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor);
                 return cursor.selectedText();
         }
+        QString textAfterPosition(int pos)
+        {
+                auto tc = textCursor();
+                tc.setPosition(pos);
+                tc.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
+                return tc.selectedText();
+        }
 
         dialogs::PreviewUploadOverlay previewDialog_;
 
         //! Latest position of the '@' character that triggers the username completer.
         int atTriggerPosition_ = -1;
 
+        void insertCompletion(QString completion);
         void textChanged();
         void uploadData(const QByteArray data, const QString &media, const QString &filename);
         void afterCompletion(int);