diff --git a/NEWS.md b/NEWS.md index 84ba4079..448e9a8e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ Red Panda C++ Version 1.1.6 - fix: block indent doesn't work + - fix: selection is not correctly set after input in column mode Red Panda C++ Version 1.1.5 diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 5a28ba38..44472ca0 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -2541,25 +2541,20 @@ void SynEdit::doTabKey() doBlockIndent(); return; } - int i = 0; - { - mUndoList->beginBlock(); - auto action = finally([this]{ - mUndoList->endBlock(); - }); - if (selAvail()) { - setSelectedTextEmpty(); - } - QString Spaces; - if (mOptions.testFlag(eoTabsToSpaces)) { - int cols = charToColumn(mCaretY,mCaretX); - i = tabWidth() - (cols) % tabWidth(); - Spaces = QString(i,' '); - } else { - Spaces = '\t'; - } - setSelTextPrimitive(QStringList(Spaces)); + mUndoList->beginBlock(); + if (selAvail()) { + setSelectedTextEmpty(); } + QString Spaces; + if (mOptions.testFlag(eoTabsToSpaces)) { + int cols = charToColumn(mCaretY,mCaretX); + int i = tabWidth() - (cols) % tabWidth(); + Spaces = QString(i,' '); + } else { + Spaces = '\t'; + } + setSelTextPrimitive(QStringList(Spaces)); + mUndoList->endBlock(); ensureCursorPosVisible(); } @@ -6634,10 +6629,9 @@ void SynEdit::onLinesChanged() if (mActiveSelectionMode == SynSelectionMode::Column) { BufferCoord oldBlockStart = blockBegin(); BufferCoord oldBlockEnd = blockEnd(); - oldBlockStart.ch = mCaretX; - int colEnd = charToColumn(oldBlockStart.line,oldBlockStart.ch); - int charEnd = columnToChar(oldBlockEnd.line,colEnd); - oldBlockEnd.ch = charEnd; + int colEnd = charToColumn(mCaretY,mCaretX); + oldBlockStart.ch = columnToChar(oldBlockStart.line,colEnd); + oldBlockEnd.ch = columnToChar(oldBlockEnd.line,colEnd); setBlockBegin(oldBlockStart); setBlockEnd(oldBlockEnd); } else {