forked from mia/Aegisub
Don't try to reorder things by swapping entries in a set
Originally committed to SVN as r5240.
This commit is contained in:
parent
2183442089
commit
ec3d1a9d35
1 changed files with 7 additions and 1 deletions
|
@ -39,10 +39,12 @@
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
#include <algorithm>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
|
#include "../ass_dialogue.h"
|
||||||
#include "../ass_file.h"
|
#include "../ass_file.h"
|
||||||
#include "../dialog_search_replace.h"
|
#include "../dialog_search_replace.h"
|
||||||
#include "../include/aegisub/context.h"
|
#include "../include/aegisub/context.h"
|
||||||
|
@ -248,8 +250,12 @@ struct edit_line_swap : public Command {
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
SelectionController<AssDialogue>::Selection sel = c->selectionController->GetSelectedSet();
|
SelectionController<AssDialogue>::Selection sel = c->selectionController->GetSelectedSet();
|
||||||
if (sel.size() == 2) {
|
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;
|
using std::swap;
|
||||||
swap(*sel.begin(), *sel.rbegin());
|
swap(*a, *b);
|
||||||
|
c->ass->Commit(_("swap lines"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue