diff options
-rw-r--r-- | src/Editor.cxx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 59e2678ab..65348f588 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5767,13 +5767,13 @@ int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { } void Editor::Indent(bool forwards) { + UndoGroup ug(pdoc); for (size_t r=0; r<sel.Count(); r++) { int lineOfAnchor = pdoc->LineFromPosition(sel.Range(r).anchor.Position()); int caretPosition = sel.Range(r).caret.Position(); int lineCurrentPos = pdoc->LineFromPosition(caretPosition); if (lineOfAnchor == lineCurrentPos) { if (forwards) { - UndoGroup ug(pdoc); pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); caretPosition = sel.Range(r).caret.Position(); if (pdoc->GetColumn(caretPosition) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) && @@ -5800,7 +5800,6 @@ void Editor::Indent(bool forwards) { } else { if (pdoc->GetColumn(caretPosition) <= pdoc->GetLineIndentation(lineCurrentPos) && pdoc->tabIndents) { - UndoGroup ug(pdoc); int indentation = pdoc->GetLineIndentation(lineCurrentPos); int indentationStep = pdoc->IndentSize(); pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); @@ -5824,10 +5823,7 @@ void Editor::Indent(bool forwards) { int lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); if (pdoc->LineStart(lineBottomSel) == sel.Range(r).anchor.Position() || pdoc->LineStart(lineBottomSel) == caretPosition) lineBottomSel--; // If not selecting any characters on a line, do not indent - { - UndoGroup ug(pdoc); - pdoc->Indent(forwards, lineBottomSel, lineTopSel); - } + pdoc->Indent(forwards, lineBottomSel, lineTopSel); if (lineOfAnchor < lineCurrentPos) { if (currentPosPosOnLine == 0) sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); |