File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,27 @@ QList<QTextEdit::ExtraSelection> createSameWordsSelections(QPlainTextEdit *textE
23
23
24
24
highlightSelection.cursor = textEdit->textCursor ();
25
25
26
- if (word == " {" ) {
26
+ if (word == " {" || word == " }" ) {
27
+ int val;
28
+ if (word == " {" ) {
29
+ val = 0 ;
30
+ } else {
31
+ val = 1 ;
32
+ }
27
33
selections.append (highlightSelection);
28
- int val = 0 ;
34
+
29
35
while (!highlightSelection.cursor .isNull () && !highlightSelection.cursor .atEnd ()) {
30
- highlightSelection.cursor =
31
- document->find (QRegularExpression (" {|}" ), highlightSelection.cursor );
36
+ if (word == " {" ) {
37
+ highlightSelection.cursor =
38
+ document->find (QRegularExpression (" {|}" ), highlightSelection.cursor );
39
+ } else {
40
+ highlightSelection.cursor =
41
+ document->find (QRegularExpression (" {|}" ), highlightSelection.cursor ,
42
+ QTextDocument::FindBackward);
43
+ }
44
+
32
45
if (!highlightSelection.cursor .isNull ()) {
33
- if (highlightSelection.cursor .selectedText () == " { " ) {
46
+ if (highlightSelection.cursor .selectedText () == word ) {
34
47
val++;
35
48
} else {
36
49
val--;
You can’t perform that action at this time.
0 commit comments