Open chernish2 opened 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.
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.
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?
This is a bit more difficult because it implies understanding internal details of Scintilla. But basically:
In scintilla/include/SciLexer.h
there are the following defintions:
#define SCLEX_RUBY 22
#define SCE_RB_DEFAULT 0
#define SCE_RB_ERROR 1
#define SCE_RB_COMMENTLINE 2
#define SCE_RB_POD 3
#define SCE_RB_NUMBER 4
#define SCE_RB_WORD 5
#define SCE_RB_STRING 6
#define SCE_RB_CHARACTER 7
#define SCE_RB_CLASSNAME 8
#define SCE_RB_DEFNAME 9
#define SCE_RB_OPERATOR 10
#define SCE_RB_IDENTIFIER 11
#define SCE_RB_REGEX 12
#define SCE_RB_GLOBAL 13
#define SCE_RB_SYMBOL 14
#define SCE_RB_MODULE_NAME 15
#define SCE_RB_INSTANCE_VAR 16
#define SCE_RB_CLASS_VAR 17
#define SCE_RB_BACKTICKS 18
#define SCE_RB_DATASECTION 19
#define SCE_RB_HERE_DELIM 20
#define SCE_RB_HERE_Q 21
#define SCE_RB_HERE_QQ 22
#define SCE_RB_HERE_QX 23
#define SCE_RB_STRING_Q 24
#define SCE_RB_STRING_QQ 25
#define SCE_RB_STRING_QX 26
#define SCE_RB_STRING_QR 27
#define SCE_RB_STRING_QW 28
#define SCE_RB_WORD_DEMOTED 29
#define SCE_RB_STDIN 30
#define SCE_RB_STDOUT 31
#define SCE_RB_STDERR 40
#define SCE_RB_UPPER_BOUND 41
In src/styles.h
there is a list of languages:
enum Language : unsigned char {
langNone,
// ...
langRuby, // <-- this is the one you want
// ...
};
In src/editstates.cc
there is a list that associates file extensions with a language:
static const const_unordered_map<std::string_view, Language> ext2lang = {
{".js", langJavaScript},
// ...
{".rb", langRuby}, // <-- already in the list, no need to touch anything
// ...
};
In src/styles.cc
there is a list that associates languages with a lexer and styling information, to which you'll have to add Ruby:
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:
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
.
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!
Commit https://github.com/magiblot/turbo/commit/f368936fc3f78117b1f0845ca7d35fc40e9db3d3 adds syntax highlighting for Ruby. What do you think?
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
^~~~~~~~~~~~
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
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
My bad, forgot about that. Works AMAZING! Thank you!
Is it possible to add file history? Would be very convenient.
Yes, I know. I don't think I will be able to add it as quickly as the Ruby syntax. It will take longer.
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:
fg
> Continue using TurboAnother nice to have would be a filebrowser on one side like geanny, vscode, codeblocks, netbeans, ...