Only highlight kara-templater templates with template syntax and not code lines. Added some non-working and commented out code to switch to full-edit-box Lua highlighting for code lines.

Originally committed to SVN as r1538.
This commit is contained in:
Niels Martin Hansen 2007-08-28 22:52:23 +00:00
parent fb7c7e1f74
commit 5d3d3294ec

View file

@ -234,6 +234,22 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
// Styling enabled? // Styling enabled?
if (Options.AsBool(_T("Syntax Highlight Enabled")) == 0) return; if (Options.AsBool(_T("Syntax Highlight Enabled")) == 0) return;
// Check if it's a template line
AssDialogue *diag = control->grid->GetDialogue(control->linen);
bool templateLine = diag && diag->Comment && diag->Effect.Lower().StartsWith(_T("template"));
bool templateCodeLine = diag && diag->Comment && diag->Effect.Lower().StartsWith(_T("code"));
// Template code lines get Lua highlighting instead of ASS highlighting
// This is broken and needs some extra work
/*if (templateCodeLine) {
SetLexer(wxSTC_LEX_LUA);
Colourise(start, start+_length);
return;
}
else {
SetLexer(wxSTC_LEX_CONTAINER);
}*
// Set variables // Set variables
wxString text = GetText(); wxString text = GetText();
int end = start + _length; int end = start + _length;
@ -243,10 +259,6 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
bool numMode = false; // everything is considered a number/parameter until this is unset bool numMode = false; // everything is considered a number/parameter until this is unset
bool drawingMode = false; // for \p1 -> \p0 stuff bool drawingMode = false; // for \p1 -> \p0 stuff
// Check if it's a template line
AssDialogue *diag = control->grid->GetDialogue(control->linen);
bool templateLine = diag && diag->Comment && (diag->Effect.Lower().StartsWith(_T("template")) || diag->Effect.Lower().StartsWith(_T("code")));
// Begin styling // Begin styling
StartStyling(0,255); StartStyling(0,255);
int ran = 0; // length of current range int ran = 0; // length of current range