Update applications/rnote/rnotefind.ring - Allow Undo using (Ctrl+Z) after Replace and Replace All operations.
@@ -130,7 +130,8 @@ class RNoteFind
nEnd = oCursor.SelectionEnd()
cStr = textedit1.toPlainText()
cStr = left(cStr,nStart)+cValue+substr(cStr,nEnd+1)
- textedit1.setPlainText(cStr)
+ setTextAllowUndo(cStr)
+ //textedit1.setPlainText(cStr)
return FindValue()
func ReplaceAll
@@ -150,7 +151,8 @@ class RNoteFind
else
cMsg = "Nothing to replace!"
ok
- textedit1.setPlainText(cStr)
+ setTextAllowUndo(cStr)
+ //textedit1.setPlainText(cStr)
new qMessagebox(oSearch)
{
SetWindowTitle("Replace All")
@@ -243,3 +245,22 @@ class RNoteFind
cString = substr(cString,substr(cString,dString)+len(string(sum)))
end
return sum
+
+ func setTextAllowUndo cText
+ # Get the Text Size
+ nTextSize = len(textedit1.toplaintext())
+ # Select All of the Text
+ oCursor = textedit1.textcursor()
+ # Save the current position
+ nPosStart = oCursor.Position()
+ oCursor.setposition(0,0)
+ textedit1.settextcursor(oCursor)
+ oCursor = textedit1.textcursor()
+ oCursor.setposition(nTextSize,1)
+ textedit1.settextcursor(oCursor)
+ # Set the new text using InsertPlainText() that support the Undo process
+ textedit1.InsertPlainText(cText)
+ # Restore the Cursor Position
+ oCursor = textedit1.textcursor()
+ oCursor.setposition(nPosStart,1)
+ textedit1.settextcursor(oCursor)
