From 7992009392dae98304d3d8f8d8663e71ea4e7928 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 22 Feb 2012 22:36:55 +0000 Subject: [PATCH] Treat an unclosed override block as plain text in the syntax highlighter to match vsfilter Originally committed to SVN as r6504. --- aegisub/src/subs_edit_ctrl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aegisub/src/subs_edit_ctrl.cpp b/aegisub/src/subs_edit_ctrl.cpp index f7fda4aa2..faadeb2df 100644 --- a/aegisub/src/subs_edit_ctrl.cpp +++ b/aegisub/src/subs_edit_ctrl.cpp @@ -284,9 +284,13 @@ void SubsTextEditCtrl::UpdateStyle() { // Check if it's a template line AssDialogue *diag = context->selectionController->GetActiveLine(); bool templateLine = diag && diag->Comment && diag->Effect.Lower().StartsWith("template"); + size_t last_template = 0; if (templateLine) last_template = text.rfind('!'); + size_t last_ovr_end = text.rfind('}'); + if (last_ovr_end == text.npos) + last_ovr_end = 0; bool in_parens = false; bool in_unparened_arg = false; @@ -339,7 +343,7 @@ void SubsTextEditCtrl::UpdateStyle() { new_style = STYLE_KARAOKE_TEMPLATE; } // Start override block - else if (cur_char == '{') { + else if (cur_char == '{' && i < last_ovr_end) { new_style = in_ovr ? STYLE_ERROR : STYLE_OVERRIDE; in_ovr = true; }