ide: Syntax highlighting small improvements

git-svn-id: svn://ultimatepp.org/upp/trunk@14554 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-06-05 11:11:51 +00:00
parent c4b116765f
commit 3f1e0406a4
4 changed files with 21 additions and 9 deletions

View file

@ -37,4 +37,15 @@ String EditorSyntax::GetSyntaxForFilename(const char *fn)
return Null;
}
String EditorSyntax::GetSyntaxDescription(int i)
{
String d = defs()[i].description;
String x = defs()[i].patterns;
if(x.GetCount()) {
x.Replace("*", "");
d << " (" << TrimBoth(x) << ")";
}
return d;
}
}

View file

@ -44,10 +44,10 @@ void RegisterSyntaxModules()
RegisterCSyntax("json", CSyntax::HIGHLIGHT_JSON, "*.json", "JSON");
RegisterCSyntax("css", CSyntax::HIGHLIGHT_CSS, "*.css", "Cascading Style Sheet");
RegisterCSyntax("sql", CSyntax::HIGHLIGHT_SQL, "*.sql *.ddl", "SQL script");
RegisterCSyntax("lay", CSyntax::HIGHLIGHT_LAY, "*.lay", "U++ layout (.lay)");
RegisterCSyntax("sch", CSyntax::HIGHLIGHT_SCH, "*.sch", "U++ SQL schema (.sch)");
RegisterCSyntax("t", CSyntax::HIGHLIGHT_T, "*.t *.jt", "U++ translation (.t)");
RegisterCSyntax("usc", CSyntax::HIGHLIGHT_USC, "*.usc", "U++ widget definitions (.usc)");
RegisterCSyntax("lay", CSyntax::HIGHLIGHT_LAY, "*.lay", "U++ layout");
RegisterCSyntax("sch", CSyntax::HIGHLIGHT_SCH, "*.sch", "U++ SQL schema");
RegisterCSyntax("t", CSyntax::HIGHLIGHT_T, "*.t *.jt", "U++ translation");
RegisterCSyntax("usc", CSyntax::HIGHLIGHT_USC, "*.usc", "U++ widget definitions");
RegisterCSyntax("calc", CSyntax::HIGHLIGHT_CALC, "", "");
RegisterCSyntax("php", CSyntax::HIGHLIGHT_PHP, "*.php", "PHP");
@ -55,11 +55,11 @@ void RegisterSyntaxModules()
EditorSyntax::Register("python", callback(CreatePythonSyntax), "*.py, *.pyc, *.pyd, *.pyo, *.pyw, *.pyz", "Python");
EditorSyntax::Register("xml", callback2(CreateTagSyntax, false, false), "*.xml *.xsd", "XML (.xml)");
EditorSyntax::Register("html", callback2(CreateTagSyntax, true, false), "*.html *.htm", "HTML (.html)");
EditorSyntax::Register("witz", callback2(CreateTagSyntax, true, true), "*.witz", "Skylark templates (.witz)");
EditorSyntax::Register("xml", callback2(CreateTagSyntax, false, false), "*.xml *.xsd", "XML");
EditorSyntax::Register("html", callback2(CreateTagSyntax, true, false), "*.html *.htm", "HTML");
EditorSyntax::Register("witz", callback2(CreateTagSyntax, true, true), "*.witz", "Skylark templates");
EditorSyntax::Register("log", callback(CreateLogSyntax), "*.log *.info", "Log (*.log)");
EditorSyntax::Register("log", callback(CreateLogSyntax), "*.log *.info", "Log");
}
}

View file

@ -136,7 +136,7 @@ public:
static String GetSyntaxForFilename(const char *fn);
static int GetSyntaxCount() { return defs().GetCount(); }
static String GetSyntax(int i) { return defs().GetKey(i); }
static String GetSyntaxDescription(int i) { return defs()[i].description; }
static String GetSyntaxDescription(int i);
static String GetSyntaxPatterns(int i) { return defs()[i].patterns; }
};

View file

@ -165,6 +165,7 @@ void Ide::FileProperties()
if(desc.GetCount())
d.highlight.Add(EditorSyntax::GetSyntax(i), desc);
}
d.highlight.Add("none", "None");
d.tabsize <<= f.tabsize > 0 ? f.tabsize : Null;
d.tabsize <<= d.Breaker(111);
d.tabsize.MinMax(1, 100);