From ec3d1a9d35c46aa033822708ccdfb5b655c992b0 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 18 Jan 2011 06:01:29 +0000 Subject: [PATCH] Don't try to reorder things by swapping entries in a set Originally committed to SVN as r5240. --- aegisub/src/command/edit.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aegisub/src/command/edit.cpp b/aegisub/src/command/edit.cpp index 13790a62f..4bce705da 100644 --- a/aegisub/src/command/edit.cpp +++ b/aegisub/src/command/edit.cpp @@ -39,10 +39,12 @@ #include "../config.h" #ifndef AGI_PRE +#include #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::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")); } } };