aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index 82b742ec..d79bdc5f 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -164,6 +164,7 @@ void PlainTextEditor::highlightMatch(QChar ch, bool forward, int fromPos, QChar
int nested = 1; //always start within the first nest (the primary nest)
int tmpFromPos = fromPos;
+ //if(!forward){ tmpFromPos++; } //need to include the initial location
QString doc = this->toPlainText();
while( nested>0 && tmpFromPos<doc.length() && ( (tmpFromPos>=fromPos && forward) || ( tmpFromPos<=fromPos && !forward ) ) ){
if(forward){
@@ -176,8 +177,10 @@ void PlainTextEditor::highlightMatch(QChar ch, bool forward, int fromPos, QChar
}else{
QTextCursor cur = this->document()->find(ch, tmpFromPos, QTextDocument::FindBackward);
if(!cur.isNull()){
- QString mid = doc.mid(cur.position()-1, tmpFromPos-cur.position());
- nested += mid.count(startch) - mid.count(ch);
+ QString mid = doc.mid(cur.position()-1, tmpFromPos-cur.position()+1);
+ //qDebug() << "Found backwards match:" << nested << startch << ch << mid;
+ //qDebug() << doc.mid(cur.position(),1) << doc.mid(tmpFromPos,1);
+ nested += (mid.count(startch) - mid.count(ch));
if(nested==0){ matchleft = cur.position(); }
else{ tmpFromPos = cur.position()-1; }
}else{ break; }
bgstack15