diff --git a/CHANGELOG.md b/CHANGELOG.md index 927e2863f..3a425bd67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - Bugfix: Fixed some channels still not loading in rare cases. (#3219) - Bugfix: Fixed a bug with usernames or emotes completing from the wrong position. (#3229) - Bugfix: Fixed second chatterino icon appearing in the dock when restarting on a crash in macOS. (#3268) +- Bugfix: Fixed `QCharRef with an index pointing outside the valid range of a QString` warning that was emitted on every Tab press. (#3234) - Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103) - Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038) diff --git a/src/widgets/helper/ResizingTextEdit.cpp b/src/widgets/helper/ResizingTextEdit.cpp index 896efed66..0182289b3 100644 --- a/src/widgets/helper/ResizingTextEdit.cpp +++ b/src/widgets/helper/ResizingTextEdit.cpp @@ -42,14 +42,8 @@ bool ResizingTextEdit::hasHeightForWidth() const bool ResizingTextEdit::isFirstWord() const { QString plainText = this->toPlainText(); - for (int i = this->textCursor().position(); i >= 0; i--) - { - if (plainText[i] == ' ') - { - return false; - } - } - return true; + QString portionBeforeCursor = plainText.left(this->textCursor().position()); + return !portionBeforeCursor.contains(' '); }; int ResizingTextEdit::heightForWidth(int) const