forked from mia/Aegisub
Fix trimming of second line in Recombine Lines
This commit is contained in:
parent
dd325acd81
commit
3948bdc6f4
1 changed files with 8 additions and 7 deletions
|
@ -852,8 +852,8 @@ void expand_times(AssDialogue *src, AssDialogue *dst) {
|
||||||
dst->End = std::max(dst->End, src->End);
|
dst->End = std::max(dst->End, src->End);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_lines(AssDialogue *d1, AssDialogue *d2, bool (*pred)(std::string const&, std::string const&)) {
|
bool check_start(AssDialogue *d1, AssDialogue *d2) {
|
||||||
if (pred(d1->Text.get(), d2->Text.get())) {
|
if (boost::starts_with(d1->Text.get(), d2->Text.get())) {
|
||||||
d1->Text = trim_text(d1->Text.get().substr(d2->Text.get().size()));
|
d1->Text = trim_text(d1->Text.get().substr(d2->Text.get().size()));
|
||||||
expand_times(d1, d2);
|
expand_times(d1, d2);
|
||||||
return true;
|
return true;
|
||||||
|
@ -861,12 +861,13 @@ bool check_lines(AssDialogue *d1, AssDialogue *d2, bool (*pred)(std::string cons
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_start(AssDialogue *d1, AssDialogue *d2) {
|
|
||||||
return check_lines(d1, d2, &boost::starts_with<std::string, std::string>);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool check_end(AssDialogue *d1, AssDialogue *d2) {
|
bool check_end(AssDialogue *d1, AssDialogue *d2) {
|
||||||
return check_lines(d1, d2, &boost::ends_with<std::string, std::string>);
|
if (boost::ends_with(d1->Text.get(), d2->Text.get())) {
|
||||||
|
d1->Text = trim_text(d1->Text.get().substr(0, d1->Text.get().size() - d2->Text.get().size()));
|
||||||
|
expand_times(d1, d2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue