diff options
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index c95985ec7..16049e20d 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2299,10 +2299,14 @@ void Editor::Indent(bool forwards) { pdoc->InsertChar(currentPos, '\t'); SetEmptySelection(currentPos + 1); } else { - for (int i = 0; i < pdoc->tabInChars; i++) { + int numSpaces = (pdoc->tabInChars) - + (pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); + if (numSpaces < 1) + numSpaces = pdoc->tabInChars; + for (int i = 0; i < numSpaces; i++) { pdoc->InsertChar(currentPos, ' '); } - SetEmptySelection(currentPos + pdoc->tabInChars); + SetEmptySelection(currentPos + numSpaces); } } else { int anchorPosOnLine = anchor - pdoc->LineStart(lineOfAnchor); |