mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
parent
3ccffd1b6e
commit
d77df271de
@ -1053,6 +1053,21 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
text = text.TrimStart('-').TrimStart();
|
||||
}
|
||||
}
|
||||
|
||||
if (oldText != text)
|
||||
{
|
||||
text = text.Replace(Environment.NewLine + "<i>" + Environment.NewLine, Environment.NewLine + "<i>");
|
||||
text = text.Replace(Environment.NewLine + "</i>" + Environment.NewLine, "</i>" + Environment.NewLine);
|
||||
if (text.StartsWith("<i>" + Environment.NewLine))
|
||||
{
|
||||
text = text.Remove(3, Environment.NewLine.Length);
|
||||
}
|
||||
if (text.EndsWith(Environment.NewLine + "</i>"))
|
||||
{
|
||||
text = text.Remove(text.Length - (Environment.NewLine.Length + 4), Environment.NewLine.Length);
|
||||
}
|
||||
text = text.Replace(Environment.NewLine + "</i>" + Environment.NewLine, "</i>" + Environment.NewLine);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
|
@ -1416,6 +1416,16 @@ namespace Test.Logic.Forms
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveTextForHiRemoveFirstBlankLineAlsoItalics()
|
||||
{
|
||||
RemoveTextForHI target = GetRemoveTextForHiLib();
|
||||
string text = "<i>Ow. Ow." + Environment.NewLine + "Ow, my head.</i>";
|
||||
const string expected = "<i>My head.</i>";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user