magiblot/turbo

Can't change tab size.

skywind3000 opened this issue · 4 comments

My favorite tabsize is 4, but the default is 8 in turbo, and I can't find a way to change it.

Hi Linwei!

Unfortunately, this cannot be currently customized from within the application. It requires changing the source code and rebuilding Turbo.

You have to modify source/turbo-core/editor.cc as follows:

--- a/source/turbo-core/editor.cc
+++ b/source/turbo-core/editor.cc
@@ -31,6 +31,7 @@ Editor::Editor(TScintilla &aScintilla) noexcept :
     // Indentation
     call(scintilla, SCI_SETUSETABS, false, 0U);
     call(scintilla, SCI_SETINDENT, 4, 0U);
+    call(scintilla, SCI_SETTABWIDTH, 4, 0U);
     call(scintilla, SCI_SETTABINDENTS, true, 0U);
     call(scintilla, SCI_SETBACKSPACEUNINDENTS, true, 0U);

Also, if you wish the tabulator key to insert tab characters instead of whitespace characters, also add this change:

-    call(scintilla, SCI_SETUSETABS, false, 0U);
+    call(scintilla, SCI_SETUSETABS, true, 0U);

fair, this project is an experiment.

I came from a discussion: microsoft/terminal#16440

this project has been mentioned by multiple participants:

Wish this PoC can actually turn into a real editor some day.

Before that, can you just set the default tabsize to 4 please ? Default to 8 is unix flavor, not so windows.

Turbo C 2.0 and Visual Studio use 4 by default.

Hi, Lin!

I've made up my mind. If the default tab size is 8 and this cannot be customized by the user, then it is very likely that code containing tab characters will look mostly messed up and the user will be able to do nothing. Therefore, I agree to a default tab size of 4 instead.

thanks