Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't change tab size. #62

Open
skywind3000 opened this issue Dec 13, 2023 · 4 comments
Open

Can't change tab size. #62

skywind3000 opened this issue Dec 13, 2023 · 4 comments

Comments

@skywind3000
Copy link

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

@magiblot
Copy link
Owner

magiblot commented Dec 13, 2023

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);

@skywind3000
Copy link
Author

skywind3000 commented Dec 13, 2023

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.

@magiblot
Copy link
Owner

magiblot commented Jan 7, 2024

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.

magiblot added a commit that referenced this issue Jan 7, 2024
Given that this cannot be currently customized by the user, use a value that is less likely to result in code containing tabs looking messed up.
See #62.
@skywind3000
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants