ecere:gui:dialogs:ReplaceDialog; restore initial selection when doing a straight...
authorRejean Loyer <rejean.loyer@gmail.com>
Wed, 20 Feb 2013 00:09:32 +0000 (19:09 -0500)
committerJerome St-Louis <jerome@ecere.com>
Wed, 6 Mar 2013 13:34:33 +0000 (08:34 -0500)
ecere/src/gui/dialogs/ReplaceDialog.ec

index db9e209..88cef7b 100644 (file)
@@ -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;
       }