Don't try to reorder things by swapping entries in a set

Originally committed to SVN as r5240.
This commit is contained in:
Thomas Goyne 2011-01-18 06:01:29 +00:00
parent 2183442089
commit ec3d1a9d35

View file

@ -39,10 +39,12 @@
#include "../config.h"
#ifndef AGI_PRE
#include <algorithm>
#endif
#include "command.h"
#include "../ass_dialogue.h"
#include "../ass_file.h"
#include "../dialog_search_replace.h"
#include "../include/aegisub/context.h"
@ -248,8 +250,12 @@ struct edit_line_swap : public Command {
void operator()(agi::Context *c) {
SelectionController<AssDialogue>::Selection sel = c->selectionController->GetSelectedSet();
if (sel.size() == 2) {
entryIter a = find(c->ass->Line.begin(), c->ass->Line.end(), *sel.begin());
entryIter b = find(c->ass->Line.begin(), c->ass->Line.end(), *sel.rbegin());
using std::swap;
swap(*sel.begin(), *sel.rbegin());
swap(*a, *b);
c->ass->Commit(_("swap lines"));
}
}
};