From 7d634a950f6b20edcd76f1b803eeacfc6b358ff6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 16 Dec 2017 18:02:13 +0300 Subject: [PATCH] CodeEditor fixed --- limereport/scripteditor/lrcodeeditor.cpp | 3 ++- limereport/scripteditor/lrscripthighlighter.cpp | 13 +++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/limereport/scripteditor/lrcodeeditor.cpp b/limereport/scripteditor/lrcodeeditor.cpp index 4e524c1..75a86bc 100644 --- a/limereport/scripteditor/lrcodeeditor.cpp +++ b/limereport/scripteditor/lrcodeeditor.cpp @@ -188,6 +188,7 @@ bool CodeEditor::matchRightParenthesis(QTextBlock currentBlock, QChar parenthesi if (data){ QVector parentheses = data->parentheses(); int docPos = currentBlock.position(); + if (i == -2) i = parentheses.size()-1; for (; i > -1 && parentheses.size() > 0; --i) { ParenthesisInfo *info = parentheses.at(i); if (info->character == parenthesisType) { @@ -205,7 +206,7 @@ bool CodeEditor::matchRightParenthesis(QTextBlock currentBlock, QChar parenthesi currentBlock = currentBlock.previous(); if (currentBlock.isValid()) - return matchRightParenthesis(currentBlock, parenthesisType, 0, numRightParentheses); + return matchRightParenthesis(currentBlock, parenthesisType, -2, numRightParentheses); } return false; diff --git a/limereport/scripteditor/lrscripthighlighter.cpp b/limereport/scripteditor/lrscripthighlighter.cpp index d88e18f..1dac14b 100644 --- a/limereport/scripteditor/lrscripthighlighter.cpp +++ b/limereport/scripteditor/lrscripthighlighter.cpp @@ -110,7 +110,11 @@ void ScriptHighlighter::highlightBlock(const QString& text) } buffer.clear(); buffer += currentChar; - + break; + case String: + case String2: + buffer.clear(); + buffer += currentChar; break; case MayBeKeyWord: case MayBeNumber: @@ -160,17 +164,10 @@ void ScriptHighlighter::highlightBlock(const QString& text) TextBlockData *data = new TextBlockData; - for (int i = 0; i < PARENHEIS_COUNT; ++i){ createParentheisisInfo(parenthesisCharacters[LeftParenthesis][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); }