And now my friends , you have it too
My merge got accepted so TextEditor control now also supports sh/bash shell scripting style/mode
So if you're on the master commit you can pull the update now.
Mode wise there was not much i could do, like how gambas auto-capitalises keywords and stuff, that sort of thing wouldn't really work in bash.
Unless some of you can think of anything you would like to happen automatically.
I might look into auto spacing when using angle brackets in if statements [] , stuff like that could work, and help
It works in the following way for highlighting...
The following list is considered Keywords and colour is set with
TextEditor1.Styles[Highlight.Keyword].Color
"function", "do", "else", "test", "for", "to", "in", "fi", "if", "elif", "then", "return", "exit", "while", "until", "done", "break", "continue", "select", "case", "esac"
The following list is considered Operators and colour is set with
TextEditor1.Styles[Highlight.Operator].Color
"{", "}", "$", "#", "[", "]", "-gt", "-lt", "-ge", "-ne", "-le", "-eq", "<<<", ".", "+", "<<", "=", ">>", "==", "-", ">>", "~", "+=", "(", ",", "!=", "*", "-=", "&=", ";;", ")", "<", "%", "&", "];", "@", "!", ";", ">", "|", "?", "^", "\\", ":", "<=", "/", "`"
As there is no Datatype defining in bash i used for a bunch of built in bash commands using
compgen -b
So the following list is classed as Datatypes and colour is set with
TextEditor1.Styles[Highlight.Datatype].Color
"echo", "read", "cd", "which", "rm", "cp", "mv", "rmdir", "cat", "grep", "awk", "tr", "sed", "sleep", "clear", "sudo", "su", "source", "eval", "export", "time", "date", "pwd", "set", "unset", "chown", "chmod", "exec", "alias", "unalias", "bg", "bind", "builtin", "caller", "command", "compgen", "complete", "compopt", "declare", "dirs", "disown", "enable", "fc", "fg", "getopts", "hash", "help", "history", "jobs", "kill", "let", "local", "logout", "mapfile", "popd", "printf", "pushd", "readarray", "readonly", "shift", "shopt", "suspend", "test", "times", "trap", "type", "typeset", "ulimit", "umask" "wait"
Numbers are detected just as in gambas highlighting
TextEditor1.Styles[Highlight.Number].Color
Most other text will identify as Symbol
TextEditor1.Styles[Highlight.Symbol].Color
Note.
For everything except Highlight.Background you can also set ...
Styles[HighlightConst].Bold and
Styles[HighlightConst].Underline boolean properties.
It detects function calls by looking for "
Word()" or "
Word() {" functions are set with
TextEditor1.Styles[Highlight.Function].Color
Single quote marks have been added to Strings detection, set with
TextEditor1.Styles[Highlight.String].Color
I also made single quotes to do the same stuff as double quotes as they are considered string delimiters in bash unlike gambas where single quote is just used for commenting.
Also selecting some text and pressing single or double quotes will not erase text but put a quote either side like it does for brackets.
Thank you and you're welcome
Bruce