mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Simplify ResizingTextEdit::isFirstWord
to avoid invalid QString index warnings (#3285)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
5a3a7281a1
commit
2bd05fd576
|
@ -30,6 +30,7 @@
|
||||||
- Bugfix: Fixed some channels still not loading in rare cases. (#3219)
|
- 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 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 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: 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)
|
- Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038)
|
||||||
|
|
||||||
|
|
|
@ -42,14 +42,8 @@ bool ResizingTextEdit::hasHeightForWidth() const
|
||||||
bool ResizingTextEdit::isFirstWord() const
|
bool ResizingTextEdit::isFirstWord() const
|
||||||
{
|
{
|
||||||
QString plainText = this->toPlainText();
|
QString plainText = this->toPlainText();
|
||||||
for (int i = this->textCursor().position(); i >= 0; i--)
|
QString portionBeforeCursor = plainText.left(this->textCursor().position());
|
||||||
{
|
return !portionBeforeCursor.contains(' ');
|
||||||
if (plainText[i] == ' ')
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int ResizingTextEdit::heightForWidth(int) const
|
int ResizingTextEdit::heightForWidth(int) const
|
||||||
|
|
Loading…
Reference in a new issue