magiblot / turbo

An experimental text editor based on Scintilla and Turbo Vision.
Other
442 stars 35 forks source link

Toggle Syntax Highlighting #38

Open amay5267 opened 1 year ago

amay5267 commented 1 year ago

Hi @magiblot How to Toggle Syntax Highlighting? Personally I would like to be able to toggle syntax highlighting on/off for C/CPP.

magiblot commented 1 year ago

Hi @amay5267!

There is currently no way to select the syntax highlighting or disable it manually, but it gets automatically enabled in these cases:

So, for example, if you open a new editor with Ctrl+N, you can enable syntax highlighting by saving the file with a .cpp/.cc/.h/etc. extension. Or, if you want to create a source code file from the command line, and you run turbo newSourceFile.cc, you will get an editor with syntax highlighting even though the file newSourceFile.cc does not exist yet.

I don't know if this is enough for what you are trying to do.

amay5267 commented 1 year ago

Hi @magiblot How to switch syntax off manually in source code for C/CPP? I like how it behaves in C# source code case e.g. newSourceFile.cs - no syntax color you see. How to do the same as C# but for pure C source code ?

amay5267 commented 1 year ago

How to not automatically enable syntax highlighting in newSourceFile.c and newSourceFile.cc files?

amay5267 commented 1 year ago

It is not automatically enabled in C# source code e.g. newSourceFile.cs

magiblot commented 1 year ago

Okay, now I understand you. There's currently no way to do this; C# source files do not get syntax highlighting because it is not supported yet.

I can implement this.

amay5267 commented 1 year ago

Perfect! As a temporary workaround I write C source code but save it with .cs extension. Than I rename the file with Turbo and with .c extension

amay5267 commented 1 year ago

I am not sure if you are familiar with Vim. If you do vim HelloWorld.c, vim opens HelloWorld.c with syntax on. Now if you are in vim and write :syntax off - magic happens. I want the same magic in Turbo.