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

Replacing can now be made undone
This commit is contained in:
boris_i 2009-05-31 12:13:37 +00:00
parent e62146f464
commit f145eebada
2 changed files with 15 additions and 4 deletions

View file

@ -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

View file

@ -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
{