Fix completion menu completing from wrong position (#3229)
Fixes #3225 https://github.com/Chatterino/chatterino2/issues/3225
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
- Bugfix: Allow starting Streamlink from Chatterino when running as a Flatpak. (#3178)
|
- Bugfix: Allow starting Streamlink from Chatterino when running as a Flatpak. (#3178)
|
||||||
- Bugfix: Fixed own IRC messages not having metadata and a link to a usercard. (#3203)
|
- Bugfix: Fixed own IRC messages not having metadata and a link to a usercard. (#3203)
|
||||||
- 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)
|
||||||
- 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)
|
||||||
|
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ void SplitInput::insertCompletionText(const QString &input_)
|
|||||||
auto input = input_ + ' ';
|
auto input = input_ + ' ';
|
||||||
|
|
||||||
auto text = edit.toPlainText();
|
auto text = edit.toPlainText();
|
||||||
auto position = edit.textCursor().position();
|
auto position = edit.textCursor().position() - 1;
|
||||||
|
|
||||||
for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--)
|
for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--)
|
||||||
{
|
{
|
||||||
@@ -583,7 +583,7 @@ void SplitInput::insertCompletionText(const QString &input_)
|
|||||||
if (done)
|
if (done)
|
||||||
{
|
{
|
||||||
auto cursor = edit.textCursor();
|
auto cursor = edit.textCursor();
|
||||||
edit.setText(text.remove(i, position - i).insert(i, input));
|
edit.setText(text.remove(i, position - i + 1).insert(i, input));
|
||||||
|
|
||||||
cursor.setPosition(i + input.size());
|
cursor.setPosition(i + input.size());
|
||||||
edit.setTextCursor(cursor);
|
edit.setTextCursor(cursor);
|
||||||
|
|||||||
Reference in New Issue
Block a user