Comments (13)
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:- The lexer, which is the program that parses Ruby text.
#define SCLEX_RUBY 22
- The styles, which have to be associated with a color.
#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:
- The language identifier.
- A struct with more fields:
- The lexer.
- A 'styles' list.
- A 'keywords' list.
- 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
.
from turbo.
Commit f368936 adds syntax highlighting for Ruby. What do you think?
from turbo.
My bad, forgot about that.
Works AMAZING!
Thank you!
from turbo.
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:
- Open files in Turbo > Close > Do things in the shell > Open Turbo and files again.
You can do this:
- Open files in Turbo > Suspend > Do things in the shell > Run
fg
> Continue using Turbo
from turbo.
Another nice to have would be a filebrowser on one side like geanny, vscode, codeblocks, netbeans, ...
from turbo.
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.
from turbo.
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.
from turbo.
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?
from turbo.
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!
from turbo.
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
from turbo.
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
from turbo.
Is it possible to add file history?
Would be very convenient.
from turbo.
Yes, I know. I don't think I will be able to add it as quickly as the Ruby syntax. It will take longer.
from turbo.
Related Issues (20)
- Toggle Syntax Highlighting HOT 7
- code folding
- macOS universal binary HOT 19
- macOS Intel binary HOT 2
- Jump to the end of file HOT 2
- Great project! Integration with Github copilot (as a plugin) HOT 2
- Saving location and size of open windows HOT 5
- Korean input support HOT 6
- Shift+Arrow_keys text selection is not working under putty4far2l HOT 2
- copy to clipboard from turbo in far2l extensions mode not working under putty4far2l HOT 1
- garbage in command line after exiting from turbo under putty4far2l HOT 13
- System clipboard integration HOT 2
- icon HOT 6
- Feature Request: Load a specific directory tree in the document tree. HOT 2
- Scrolling down using mouse wheel problem HOT 2
- install TARGETS given target "fmt" which does not exist. HOT 1
- Feature request: highlighting for text files
- consider switching from Alt-X to Ctrl-X as exit hotkey HOT 7
- Make the first release. HOT 2
- segfault HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbo.