Keep the old active line when an automation script changes the selection but not active line

This commit is contained in:
Thomas Goyne 2014-04-16 08:04:20 -07:00
parent 162e119afa
commit d07cba4875

View file

@ -910,14 +910,14 @@ namespace Automation4 {
auto lines = subsobj->ProcessingComplete(StrDisplay(c));
AssDialogue *active_line = nullptr;
int active_idx = 0;
int active_idx = original_active;
// Check for a new active row
if (lua_isnumber(L, -1)) {
active_idx = lua_tointeger(L, -1);
if (active_idx < 1 || active_idx > (int)lines.size()) {
wxLogError("Active row %d is out of bounds (must be 1-%u)", active_idx, lines.size());
active_idx = 0;
active_idx = original_active;
}
}