forked from qt-creator/qt-creator
TextEditor: always replace cursor
Otherwise some internal data might be outdated. For example inserting text resets the QTextCursorPrivate::x which is used to calculate positions when moving the cursor up or down. Fixes: QTCREATORBUG-26635 Change-Id: I9fee7436a3648f9d3eab7b30f8a09a134c5be356 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -6257,10 +6257,10 @@ MultiTextCursor TextEditorWidget::multiTextCursor() const
|
||||
|
||||
void TextEditorWidget::setMultiTextCursor(const Utils::MultiTextCursor &cursor)
|
||||
{
|
||||
if (d->m_cursors == cursor)
|
||||
return;
|
||||
MultiTextCursor oldCursor = d->m_cursors;
|
||||
const MultiTextCursor oldCursor = d->m_cursors;
|
||||
const_cast<MultiTextCursor &>(d->m_cursors) = cursor;
|
||||
if (oldCursor == d->m_cursors)
|
||||
return;
|
||||
doSetTextCursor(d->m_cursors.mainCursor(), /*keepMultiSelection*/ true);
|
||||
QRect updateRect = d->cursorUpdateRect(oldCursor);
|
||||
if (d->m_highlightCurrentLine)
|
||||
|
Reference in New Issue
Block a user