From: Rejean Loyer Date: Wed, 20 Feb 2013 00:09:32 +0000 (-0500) Subject: ecere:gui:dialogs:ReplaceDialog; restore initial selection when doing a straight... X-Git-Tag: 0.44.04~48 X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?p=sdk;a=commitdiff_plain;h=fa86f905ff7ae1c643198f6d7f94ae95492bb013 ecere:gui:dialogs:ReplaceDialog; restore initial selection when doing a straight replace all to allow doing multiple replace all in the same selection without having to redo the selection. --- diff --git a/ecere/src/gui/dialogs/ReplaceDialog.ec b/ecere/src/gui/dialogs/ReplaceDialog.ec index db9e209..88cef7b 100644 --- a/ecere/src/gui/dialogs/ReplaceDialog.ec +++ b/ecere/src/gui/dialogs/ReplaceDialog.ec @@ -269,6 +269,9 @@ private: EditLine line1, line2; int sel1X, sel1Y, sel2X, sel2Y; + EditLine bakLine1, bakLine2; + int bakSel1X, bakSel1Y, bakSel2X, bakSel2Y; + bool selectionOnly = selection.checked; bool wholeWord = this.wholeWord.checked; bool matchCase = this.matchCase.checked; @@ -281,6 +284,8 @@ private: wrapped = 0; entriesReplaced = entriesFound = 0; + editBox.GetSelPos(&bakLine1, &bakSel1Y, &bakSel1X, &bakLine2, &bakSel2Y, &bakSel2X, true); + // If in selection mode, the end of the selection is the end point of the replace if(selectionOnly) editBox.GetSelPos(null, null, null, @@ -351,9 +356,14 @@ private: MessageBox { type = ok, master = this, text = $"Search Finished", contents = contents }.Modal(); } - selection.disabled = true; - wholeFile.checked = true; - continued = false; + if(!continued) + editBox.Select(bakLine2, bakSel2Y, bakSel2X, bakLine1, bakSel1Y, bakSel1X); + else + { + selection.disabled = true; + wholeFile.checked = true; + continued = false; + } findNext.isDefault = true; return true; }