forked from mia/Aegisub
Made the syntax highlighter check if it's a template line before applying template highlighting to it.
Originally committed to SVN as r1514.
This commit is contained in:
parent
81856dbe67
commit
352c4c93d1
1 changed files with 7 additions and 2 deletions
|
@ -43,6 +43,7 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "ass_dialogue.h"
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
|
@ -242,6 +243,10 @@ 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"));
|
||||||
|
|
||||||
// Begin styling
|
// Begin styling
|
||||||
StartStyling(0,255);
|
StartStyling(0,255);
|
||||||
int ran = 0; // length of current range
|
int ran = 0; // length of current range
|
||||||
|
@ -292,7 +297,7 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Karaoke template block
|
// Karaoke template block
|
||||||
else if (curChar == _T('!')) {
|
else if (templateLine && curChar == _T('!')) {
|
||||||
// Apply previous style
|
// Apply previous style
|
||||||
SetUnicodeStyling(curPos,ran,curStyle);
|
SetUnicodeStyling(curPos,ran,curStyle);
|
||||||
curPos += ran;
|
curPos += ran;
|
||||||
|
@ -306,7 +311,7 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
i = endPos+0;
|
i = endPos+0;
|
||||||
}
|
}
|
||||||
// Karaoke template variable
|
// Karaoke template variable
|
||||||
else if (curChar == _T('$')) {
|
else if (templateLine && curChar == _T('$')) {
|
||||||
// Apply previous style
|
// Apply previous style
|
||||||
SetUnicodeStyling(curPos,ran,curStyle);
|
SetUnicodeStyling(curPos,ran,curStyle);
|
||||||
curPos += ran;
|
curPos += ran;
|
||||||
|
|
Loading…
Add table
Reference in a new issue