From 65f78f4f36c7f5c48e1a7cbf51a1a7438857627e Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 13 Oct 2000 12:10:36 +0000 Subject: Fix from Peter to make tab key fill up to tab stop when using spaces. --- src/Editor.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3