From 5d3d3294ecddae5449bf5c4a5c5b8d5ca1530009 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Tue, 28 Aug 2007 22:52:23 +0000 Subject: [PATCH] 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. --- aegisub/subs_edit_ctrl.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/aegisub/subs_edit_ctrl.cpp b/aegisub/subs_edit_ctrl.cpp index 424d13a0a..544d8e106 100644 --- a/aegisub/subs_edit_ctrl.cpp +++ b/aegisub/subs_edit_ctrl.cpp @@ -234,6 +234,22 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) { // Styling enabled? 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 wxString text = GetText(); 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 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 StartStyling(0,255); int ran = 0; // length of current range