aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2000-10-13 12:10:36 +0000
committernyamatongwe <devnull@localhost>2000-10-13 12:10:36 +0000
commit65f78f4f36c7f5c48e1a7cbf51a1a7438857627e (patch)
tree2b79475e74f57ab22e56d1933f7d690ca60b8e71
parentc8d4b2060a80b4045d082056c062dd999ebf4886 (diff)
downloadscintilla-mirror-65f78f4f36c7f5c48e1a7cbf51a1a7438857627e.tar.gz
Fix from Peter to make tab key fill up to tab stop when using spaces.
-rw-r--r--src/Editor.cxx8
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);