File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2023 Nick Egorrov, nicegorov@yandex.ru
2+ * Copyright (C) 2023-2025 Nick Egorrov, nicegorov@yandex.ru
33 *
44 * This file is part of GCodeWorkShop.
55 *
@@ -98,6 +98,16 @@ void Addons::Context::push(const QString& text)
9898 cursor.setPosition (m_fragmentEnd, QTextCursor::MoveAnchor);
9999 cursor.setPosition (m_fragmentStart, QTextCursor::KeepAnchor);
100100 cursor.insertText (text);
101+ int diff = text.size () - m_fragmentEnd + m_fragmentStart;
102+
103+ if (m_selectionStart == m_fragmentEnd) {
104+ m_selectionStart += diff;
105+ }
106+
107+ if (m_selectionEnd == m_fragmentEnd) {
108+ m_selectionEnd += diff;
109+ }
110+
101111 cursor.setPosition (m_selectionEnd, QTextCursor::MoveAnchor);
102112 cursor.setPosition (m_selectionStart, QTextCursor::KeepAnchor);
103113 m_edit->setTextCursor (cursor);
You can’t perform that action at this time.
0 commit comments