Skip to content

Commit 657675f

Browse files
committed
Try to fix RemoveTextForHI webvtt issue - thx Manujito :)
Work on #9146
1 parent 36e2c8c commit 657675f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/libse/Common/StrippableText.cs

+15
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ public StrippableText(string input, string stripStartCharacters, string stripEnd
9393
Post = text.Substring(text.Length - 7) + Post;
9494
text = text.Substring(0, text.Length - 7);
9595
}
96+
97+
if (text.EndsWith('>'))
98+
{
99+
var lastIndexOfStart = text.LastIndexOf("<");
100+
if (lastIndexOfStart >= 0)
101+
{
102+
var tag = text.Substring(lastIndexOfStart);
103+
tag = tag.TrimStart('<').TrimEnd('>');
104+
if (tag.StartsWith("/c.", StringComparison.Ordinal) && !tag.Contains(' ') && !tag.Contains('\n'))
105+
{
106+
Post = text.Substring(lastIndexOfStart) + Post;
107+
text = text.Substring(0, lastIndexOfStart);
108+
}
109+
}
110+
}
96111
}
97112
}
98113
while (text.Length < beginLength);

src/ui/Logic/CommandLineConvert/CommandLineConverter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2223,8 +2223,8 @@ internal static Subtitle RunActions(TextEncoding targetEncoding, Subtitle sub, S
22232223

22242224
break;
22252225
case BatchAction.RemoveTextForHI:
2226-
var hiSettings = new Core.Forms.RemoveTextForHISettings(sub);
2227-
var hiLib = new Core.Forms.RemoveTextForHI(hiSettings);
2226+
var hiSettings = new RemoveTextForHISettings(sub);
2227+
var hiLib = new RemoveTextForHI(hiSettings);
22282228
var lang = LanguageAutoDetect.AutoDetectGoogleLanguage(sub);
22292229

22302230
var index = sub.Paragraphs.Count - 1;

0 commit comments

Comments
 (0)