aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp7
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp2
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/tests/test.cpp13
3 files changed, 18 insertions, 4 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index 6f583e4e..82b742ec 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -166,17 +166,18 @@ void PlainTextEditor::highlightMatch(QChar ch, bool forward, int fromPos, QChar
int tmpFromPos = fromPos;
QString doc = this->toPlainText();
while( nested>0 && tmpFromPos<doc.length() && ( (tmpFromPos>=fromPos && forward) || ( tmpFromPos<=fromPos && !forward ) ) ){
- if(forward){
+ if(forward){
QTextCursor cur = this->document()->find(ch, tmpFromPos);
if(!cur.isNull()){
nested += doc.mid(tmpFromPos+1, cur.position()-tmpFromPos).count(startch) -1;
if(nested==0){ matchright = cur.position(); }
else{ tmpFromPos = cur.position(); }
}else{ break; }
- }else{
+ }else{
QTextCursor cur = this->document()->find(ch, tmpFromPos, QTextDocument::FindBackward);
if(!cur.isNull()){
- nested += doc.mid(cur.position(), tmpFromPos-cur.position()).count(startch) -1;
+ QString mid = doc.mid(cur.position()-1, tmpFromPos-cur.position());
+ nested += mid.count(startch) - mid.count(ch);
if(nested==0){ matchleft = cur.position(); }
else{ tmpFromPos = cur.position()-1; }
}else{ break; }
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
index 3b4dd003..c13385d7 100644
--- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
@@ -52,7 +52,7 @@ void Custom_Syntax::loadRules(QString type){
if(type=="C++"){
//Keywords (standard C/C++/Qt definitions)
QStringList keywords;
- keywords << "char" << "class" << "const" << "double" << "enum" << "explicit" << "extern" << "friend" << "inline" \
+ keywords << "char" << "class" << "const" << "double" << "enum" << "explicit" << "extern" << "float" << "friend" << "inline" \
<< "int" << "long" << "namespace" << "operator" << "private" << "protected" << "public" \
<< "short" << "signals" << "signed" << "slots" << "static" << "struct" << "template" \
<< "typedef" << "typename" << "union" << "unsigned" << "virtual" << "void" << "volatile" \
diff --git a/src-qt5/desktop-utils/lumina-textedit/tests/test.cpp b/src-qt5/desktop-utils/lumina-textedit/tests/test.cpp
new file mode 100644
index 00000000..f78748bf
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-textedit/tests/test.cpp
@@ -0,0 +1,13 @@
+Test(QString test){
+ nestedFunction(){ }
+}
+if else done
+return exit
+bool float double
+
+some stuff // in-line comment
+
+some stuff /*multi
+line
+comment*/
+stuff
bgstack15