forked from mia/Aegisub
Treat an unclosed override block as plain text in the syntax highlighter to match vsfilter
Originally committed to SVN as r6504.
This commit is contained in:
parent
7e9608cf7a
commit
7992009392
1 changed files with 5 additions and 1 deletions
|
@ -284,9 +284,13 @@ void SubsTextEditCtrl::UpdateStyle() {
|
||||||
// Check if it's a template line
|
// Check if it's a template line
|
||||||
AssDialogue *diag = context->selectionController->GetActiveLine();
|
AssDialogue *diag = context->selectionController->GetActiveLine();
|
||||||
bool templateLine = diag && diag->Comment && diag->Effect.Lower().StartsWith("template");
|
bool templateLine = diag && diag->Comment && diag->Effect.Lower().StartsWith("template");
|
||||||
|
|
||||||
size_t last_template = 0;
|
size_t last_template = 0;
|
||||||
if (templateLine)
|
if (templateLine)
|
||||||
last_template = text.rfind('!');
|
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_parens = false;
|
||||||
bool in_unparened_arg = false;
|
bool in_unparened_arg = false;
|
||||||
|
@ -339,7 +343,7 @@ void SubsTextEditCtrl::UpdateStyle() {
|
||||||
new_style = STYLE_KARAOKE_TEMPLATE;
|
new_style = STYLE_KARAOKE_TEMPLATE;
|
||||||
}
|
}
|
||||||
// Start override block
|
// Start override block
|
||||||
else if (cur_char == '{') {
|
else if (cur_char == '{' && i < last_ovr_end) {
|
||||||
new_style = in_ovr ? STYLE_ERROR : STYLE_OVERRIDE;
|
new_style = in_ovr ? STYLE_ERROR : STYLE_OVERRIDE;
|
||||||
in_ovr = true;
|
in_ovr = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue