bobbylight / RSyntaxTextArea

A syntax highlighting, code folding text editor for Java Swing applications.
BSD 3-Clause "New" or "Revised" License
1.12k stars 259 forks source link

Allow spaces to be used instead of tabs #470

Closed OndrejSpanel closed 1 year ago

OndrejSpanel commented 1 year ago

Describe the solution you'd like

Autoindent currently uses Tab characters ("\t") for indentation. It could be nice to have this configurable, so that eg. " " or " " (two or four spaces) could be used instead, or any other whitespace character sequence.

Are there any workarounds? I am not aware of any.

Additional context Tabs are sometimes confusing when copying and pasting code from / to environment which does not use them.

OndrejSpanel commented 1 year ago

If this sounds like a reasonable suggestion, I think I can prepare a PR.

It seems it would be enough to adjust insertNewlineWithAutoIndent - automatic un-indentation in CloseCurlyBraceAction seems to be already flexible enough to handle any whitespace combinations very well.

bobbylight commented 1 year ago

This is already doable with setTabsEmulated(true). Are you seeing a scenario where tabs are inserted if this property is set to true?

OndrejSpanel commented 1 year ago

I was not aware of that option. Sounds exactly like what I need, thanks.