From 5f00eb62f40b5f2bae868a4ef3b9727069ad4bab Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 6 Apr 2012 15:50:54 +0000 Subject: [PATCH] Fix a case where Recombine Lines would leave an empty line If a "1, 1+2, 1" pattern appeared at the end of the selection the blank line at the end would never get cleaned up as it's removed when the line after it is checked for recombination, so add a special case for that. Closes #1468. Originally committed to SVN as r6669. --- aegisub/src/subs_grid.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aegisub/src/subs_grid.cpp b/aegisub/src/subs_grid.cpp index 47838093e..d3fd7862d 100644 --- a/aegisub/src/subs_grid.cpp +++ b/aegisub/src/subs_grid.cpp @@ -109,6 +109,12 @@ void SubtitlesGrid::RecombineLines() { context->ass->Line.remove(d1); continue; } + // If d2 is the last line in the selection it'll never hit the above test + if (d2 == end && (*d2)->Text.empty()) { + delete *d2; + context->ass->Line.remove(*d2); + continue; + } // 1, 1+2 while (d2 <= end && (*d2)->Text.StartsWith(d1->Text, &(*d2)->Text)) {