magiblot / turbo

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

[Feature request] #5

Open chernish2 opened 3 years ago

chernish2 commented 3 years ago

turbo

magiblot commented 3 years ago

Hi Alexey! Thanks for your suggestions. Unfortunately, I don't have much time to work on new features.

It would be nice to have a "Help" menu on the top right, like almost every old TV software has. Just for the feel of it. It could contain only one item like "About". Would be super-cool!

This is very simple to do. Why don't you try it yourself? The menu bar entries are defined in the function TMenuBar *TurboApp::initMenuBar(TRect r) in src/app.cc. The tvdemo sample application in the main Turbo Vision repository has an example of an "About..." dialog.

Also it would be nice to have a switch between 25 lines and 43/50 lines (like ALT+F9 in NC or VC for example).

While I understand this may be nostalgic, I really don't see the point of it. You are on Linux, right? Then the most comfortable thing you can do is resize the terminal window with the mouse. The same happens on modern Windows. The 25 vs 43/50 lines choice was a limitation of the hardware and the operating system of the era. Modern terminal applications don't work like that. I can't instruct the terminal to use a 8x8 font, either.

magiblot commented 3 years ago

What I said about the "About" dialog was not a joke. If you have some free time, writing a little bit of C++ can be a good entertainment. I encourage you to try it.

chernish2 commented 3 years ago

Ok, thanks. Probably it would be better idea to try to enable Ruby highlighting then. Because I really need it. Can you provide some insights?

magiblot commented 3 years ago

This is a bit more difficult because it implies understanding internal details of Scintilla. But basically:

static const const_unordered_map<Language, LexerInfo> lexerStyles = {
    {langCPP, {SCLEX_CPP, stylesC, keywordsC, propertiesC}},
    {langMakefile, {SCLEX_MAKEFILE, stylesMake, nullptr, nullptr}},
    {langAsm, {SCLEX_ASM, stylesAsm, nullptr, nullptr}},
    {langJavaScript, {SCLEX_CPP, stylesC, keywordsJavaScript, propertiesC}},
    {langRust, {SCLEX_RUST, stylesRust, keywordsRust, nullptr}},
    {langPython, {SCLEX_PYTHON, stylesPython, keywordsPython, propertiesPython}},
    {langBash, {SCLEX_BASH, stylesBash, keywordsBash, nullptr}},
};

Each entry in this list has the following fields:

  1. The language identifier.
  2. A struct with more fields:
    1. The lexer.
    2. A 'styles' list.
    3. A 'keywords' list.
    4. A 'lexer properties' list. These are settings offered by the lexer. You can ignore this for now and set it to nullptr.

So please look at the 'styles' and 'keywords' lists that are already defined for the other languages and figure out how to make one for Ruby. Please notice that the last element in the 'styles' list has to be {(uchar) -1, {}},, and the last element in the keywords list has to be {(uchar) -1, nullptr},.

To understand what every SCE_RB_ constant means, you can took at the lexer's source code in scintilla/lexers/LexRuby.cxx.

chernish2 commented 3 years ago

Thank you for clarification! I checked the project and found it a little bit hard for me. So I'm hoping that you will have some time in the future to add Ruby (I tried SciTe and it understand Ruby syntax). Thank you!

magiblot commented 3 years ago

Commit https://github.com/magiblot/turbo/commit/f368936fc3f78117b1f0845ca7d35fc40e9db3d3 adds syntax highlighting for Ruby. What do you think?

Screenshot_20201024_021805

chernish2 commented 3 years ago

Following my own instruction, git clone etc, then it fails to build:

[ 96%] Linking CXX static library libscintilla.a [ 96%] Built target scintilla Scanning dependencies of target turbo [ 97%] Building CXX object CMakeFiles/turbo.dir/cmake_pch.hxx.gch In file included from /home/chernish2/soft/turbo/CMakeFiles/turbo.dir/cmake_pch.hxx:5:0, from :0: /home/chernish2/soft/turbo/include/ScintillaHeaders.h:48:10: fatal error: filesystem: No such file or directory

include

      ^~~~~~~~~~~~

compilation terminated. CMakeFiles/turbo.dir/build.make:82: recipe for target 'CMakeFiles/turbo.dir/cmake_pch.hxx.gch' failed make[2]: [CMakeFiles/turbo.dir/cmake_pch.hxx.gch] Error 1 CMakeFiles/Makefile2:123: recipe for target 'CMakeFiles/turbo.dir/all' failed make[1]: [CMakeFiles/turbo.dir/all] Error 2 Makefile:102: recipe for target 'all' failed make: *** [all] Error 2

magiblot commented 3 years ago

The filesystem header again... Like I said in the other thread, can you try the following command and then compile again?

rm CMakeCache.txt && CXX=g++-8 cmake .

You may also want to change the default compiler version. The following pages might help you:

https://stackoverflow.com/questions/7832892/how-to-change-the-default-gcc-compiler-in-ubuntu

https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version

chernish2 commented 3 years ago

My bad, forgot about that. Works AMAZING! Thank you!

chernish2 commented 3 years ago

Is it possible to add file history? Would be very convenient.

magiblot commented 3 years ago

Yes, I know. I don't think I will be able to add it as quickly as the Ruby syntax. It will take longer.

magiblot commented 3 years ago

Is it possible to add file history?

In the meantime, you can take advantage of the "File > Suspend" feature (if you were not doing so already).

Instead of doing this:

You can do this:

mingodad commented 3 years ago

Another nice to have would be a filebrowser on one side like geanny, vscode, codeblocks, netbeans, ...