Skip to content
Snippets Groups Projects
Commit f145eeba authored by boris_i's avatar boris_i
Browse files

Fixed a bug where selected lines were deselected when trying to find/replace

Replacing can now be made undone
parent e62146f4
No related branches found
No related tags found
No related merge requests found
......@@ -89,10 +89,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Select linedefs by sectors
foreach(Linedef ld in General.Map.Map.Linedefs)
{
bool front, back;
if(ld.Front != null) front = ld.Front.Sector.Selected; else front = false;
if(ld.Back != null) back = ld.Back.Sector.Selected; else back = false;
ld.Selected = front | back;
if (ld.Selected == false)
{
bool front, back;
if (ld.Front != null) front = ld.Front.Sector.Selected; else front = false;
if (ld.Back != null) back = ld.Back.Sector.Selected; else back = false;
ld.Selected = front | back;
}
}
// Show toolbox window
......
......@@ -169,8 +169,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Perform the search / replace and show the results
if(doreplace.Checked)
{
int ticket = General.Map.UndoRedo.CreateUndo("Replace " + searchtypes.SelectedItem);
resultslist.Items.AddRange(finder.Find(findinput.Text, withinselection.Checked, replaceinput.Text, false));
resultscount.Text = resultslist.Items.Count + " items found and replaced.";
// Withdraw the undo step if nothing was replaced
if (resultslist.Items.Count <= 0)
{
General.Map.UndoRedo.WithdrawUndo(ticket);
}
}
else
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment