Skip to content

Commit b1b5a37

Browse files
committed
GCoderDocument: add undo/redo for replace operations
1 parent fa2e19c commit b1b5a37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gcodeworkshop/src/gcoderdocument.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,6 @@ bool GCoderDocument::replaceNext(QString textToFind,
838838

839839
bool found = false;
840840

841-
textEdit()->blockSignals(true);
842-
843841
if (foundTextMatched(textToFind, selectedText())) {
844842
found = true;
845843
} else {
@@ -911,7 +909,6 @@ bool GCoderDocument::replaceNext(QString textToFind,
911909
found = findNext(textToFind, wholeWords, ignoreCase, ignoreComments, backward);
912910
}
913911

914-
textEdit()->blockSignals(false);
915912
cursorMoved();
916913
highlightFindText(textToFind, wholeWords, ignoreCase, ignoreComments, backward);
917914

@@ -942,6 +939,7 @@ bool GCoderDocument::replaceAll(QString textToFind,
942939
}
943940

944941
QTextCursor startCursor = textCursor();
942+
startCursor.beginEditBlock();
945943

946944
while (found) {
947945
found = replaceNext(textToFind, replacedText, backward, wholeWords, ignoreCase, ignoreComments);
@@ -953,6 +951,8 @@ bool GCoderDocument::replaceAll(QString textToFind,
953951
qApp->processEvents();
954952
}
955953

954+
startCursor.endEditBlock();
955+
956956
return found;
957957
}
958958

0 commit comments

Comments
 (0)