mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2025-02-01 05:21:40 +01:00
Fix issue regarding "fix missing space" and hashtag
This commit is contained in:
parent
2173c37e56
commit
9ab1e9e3f6
@ -1904,6 +1904,7 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<GoToNextSubtitleAndFocusVideo>Go to next line and set video position</GoToNextSubtitleAndFocusVideo>
|
||||
<ToggleFocus>Toggle focus between list view and subtitle text box</ToggleFocus>
|
||||
<ToggleDialogDashes>Toggle dialog dashes</ToggleDialogDashes>
|
||||
<ToggleMusicSymbols>Toggle music symbols</ToggleMusicSymbols>
|
||||
<Alignment>Alignment (selected lines)</Alignment>
|
||||
<CopyTextOnly>Copy text only to clip board (selected lines)</CopyTextOnly>
|
||||
<CopyTextOnlyFromOriginalToCurrent>Copy text from original to current</CopyTextOnlyFromOriginalToCurrent>
|
||||
|
@ -207,7 +207,9 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
{
|
||||
foreach (var musicSymbol in musicSymbols)
|
||||
{
|
||||
lines[lineIndex] = FixMissingSpaceBeforeAfterMusicQuotes(lines[lineIndex], musicSymbol);
|
||||
var fix = !(musicSymbol == '#' && Utilities.CountTagInText(lines[lineIndex], musicSymbol) == 1 && !lines[lineIndex].EndsWith(musicSymbol));
|
||||
if (fix)
|
||||
lines[lineIndex] = FixMissingSpaceBeforeAfterMusicQuotes(lines[lineIndex], musicSymbol);
|
||||
}
|
||||
}
|
||||
string newText = string.Join(Environment.NewLine, lines);
|
||||
|
@ -945,6 +945,32 @@ namespace Test
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixMissingSpacesMusicHashtags()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
const string input = "#Dream, little one#";
|
||||
const string expected = "# Dream, little one #";
|
||||
InitializeFixCommonErrorsLine(target, input);
|
||||
new FixMissingSpaces().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual(_subtitle.Paragraphs[0].Text, expected);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixMissingSpacesDontRemoveHashTag()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
const string input = "#Dream";
|
||||
const string expected = "#Dream";
|
||||
InitializeFixCommonErrorsLine(target, input);
|
||||
new FixMissingSpaces().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual(_subtitle.Paragraphs[0].Text, expected);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Fix missing spaces
|
||||
|
||||
#region Fix unneeded spaces
|
||||
|
Loading…
x
Reference in New Issue
Block a user