0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

CodeEditor fixed

This commit is contained in:
Arin Alexander 2017-12-16 18:02:13 +03:00
parent be2b187d4f
commit 7d634a950f
2 changed files with 7 additions and 9 deletions

View File

@ -188,6 +188,7 @@ bool CodeEditor::matchRightParenthesis(QTextBlock currentBlock, QChar parenthesi
if (data){ if (data){
QVector<ParenthesisInfo *> parentheses = data->parentheses(); QVector<ParenthesisInfo *> parentheses = data->parentheses();
int docPos = currentBlock.position(); int docPos = currentBlock.position();
if (i == -2) i = parentheses.size()-1;
for (; i > -1 && parentheses.size() > 0; --i) { for (; i > -1 && parentheses.size() > 0; --i) {
ParenthesisInfo *info = parentheses.at(i); ParenthesisInfo *info = parentheses.at(i);
if (info->character == parenthesisType) { if (info->character == parenthesisType) {
@ -205,7 +206,7 @@ bool CodeEditor::matchRightParenthesis(QTextBlock currentBlock, QChar parenthesi
currentBlock = currentBlock.previous(); currentBlock = currentBlock.previous();
if (currentBlock.isValid()) if (currentBlock.isValid())
return matchRightParenthesis(currentBlock, parenthesisType, 0, numRightParentheses); return matchRightParenthesis(currentBlock, parenthesisType, -2, numRightParentheses);
} }
return false; return false;

View File

@ -110,7 +110,11 @@ void ScriptHighlighter::highlightBlock(const QString& text)
} }
buffer.clear(); buffer.clear();
buffer += currentChar; buffer += currentChar;
break;
case String:
case String2:
buffer.clear();
buffer += currentChar;
break; break;
case MayBeKeyWord: case MayBeKeyWord:
case MayBeNumber: case MayBeNumber:
@ -160,17 +164,10 @@ void ScriptHighlighter::highlightBlock(const QString& text)
TextBlockData *data = new TextBlockData; TextBlockData *data = new TextBlockData;
for (int i = 0; i < PARENHEIS_COUNT; ++i){ for (int i = 0; i < PARENHEIS_COUNT; ++i){
createParentheisisInfo(parenthesisCharacters[LeftParenthesis][i].toLatin1(), data, text); createParentheisisInfo(parenthesisCharacters[LeftParenthesis][i].toLatin1(), data, text);
createParentheisisInfo(parenthesisCharacters[RightParenthesis][i].toLatin1(), data, text); createParentheisisInfo(parenthesisCharacters[RightParenthesis][i].toLatin1(), data, text);
} }
// createParentheisisInfo('(', data, text);
// createParentheisisInfo(')', data, text);
// createParentheisisInfo('{', data, text);
// createParentheisisInfo('}', data, text);
// createParentheisisInfo('[', data, text);
// createParentheisisInfo(']', data, text);
setCurrentBlockUserData(data); setCurrentBlockUserData(data);
} }