I want to use spaces instead of tabs. I found this SO post that seems to address the issue. I used the accepted answer, but I'm still having a problem. If I hit the tab key at the beginning of a line that starts with non-spaces, the tabbing works correctly. However, if I click anywhere on a line past the IndentWidth
and hit the tab key, it tabs up to 8 spaces.
E.g.
My IndentWidth
is 2. My text is ABCDEFGHI
. I'm using periods to represent spaces.
If I click in front of the A
and hit tab, my text becomes ..ABCDEFGHI
(this is correct)
If I click in front of the B
and hit tab, my text becomes A.BCDEFGHI
(this is correct)
If I click in front of the C
and hit tab, my text becomes AB......CDEFGHI
(this is NOT correct)
Also, if the cursor is anywhere in the leading spaces of a line, when I hit the tab key, the cursor moves to the first non-space character, and then tabs from there.
E.g.
My IndentWidth
is 2. My text is ....WXYZ
. I'm using periods to represent spaces.
If I click anywhere in the first four spaces and hit tab, the cursor moves to the W
and then my text becomes ........WXYZ
. (this is NOT correct)
UPDATE
I neglected to mention that I had specifically set the Indentation properties in code as below:
scintilla.Indentation.ShowGuides = true;
scintilla.Indentation.IndentWidth = 2;
scintilla.Indentation.TabIndents = true;
scintilla.Indentation.UseTabs = false;
I just tried setting the IndentWidth
to 2 in the property editor at design time, and now it seems to be working correctly.
Conclusion: There is some disjoin between how the editor behaves when the properties are set at design-time vs. run-time.