From 3cdce44ddeb99d0eaa5426c867cc4efbc1b48638 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 11 Jun 2001 12:27:07 +0000 Subject: Patch from Michele to make tab and backspace in indentation work better. --- src/Editor.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Editor.cxx b/src/Editor.cxx index 52de15714..235d09261 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1754,11 +1754,15 @@ void Editor::DelCharBack() { if (currentPos == anchor) { int lineCurrentPos = pdoc->LineFromPosition(currentPos); if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) && - pdoc->GetColumn(currentPos) > 0 && pdoc->backspaceUnindents) { + pdoc->GetColumn(currentPos) > 0 && pdoc->backspaceUnindents) { pdoc->BeginUndoAction(); int indentation = pdoc->GetLineIndentation(lineCurrentPos); int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars); - pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); + if (indentation % indentationStep == 0) { + pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); + } else { + pdoc->SetLineIndentation(lineCurrentPos, indentation - (indentation % indentationStep)); + } SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos)); pdoc->EndUndoAction(); } else { -- cgit v1.2.3