forked from mia/Aegisub
"Intelligently" append dialogue lines to the end of the Events section instead of to the absolute end of file. This will make appending lines slower if attachments are present, but much safer. Updates #1211.
Originally committed to SVN as r4598.
This commit is contained in:
parent
6b36d730af
commit
4f0982c7d5
1 changed files with 11 additions and 1 deletions
|
@ -776,7 +776,17 @@ namespace Automation4 {
|
|||
for (int i = 1; i <= n; i++) {
|
||||
lua_pushvalue(L, i);
|
||||
AssEntry *e = LuaToAssEntry(L);
|
||||
laf->ass->Line.push_back(e);
|
||||
if (e->GetType() == ENTRY_DIALOGUE) {
|
||||
// find insertion point, looking backwards
|
||||
std::list<AssEntry*>::iterator it = laf->ass->Line.end();
|
||||
do { --it; } while ((*it)->GetType() != ENTRY_DIALOGUE);
|
||||
// found last dialogue entry in file, move one past
|
||||
++it;
|
||||
laf->ass->Line.insert(it, e);
|
||||
}
|
||||
else {
|
||||
laf->ass->Line.push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue