mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Added regex validation to "edit of do-not-break-after-list" + double "P" - thx Ivandrofly :)
This commit is contained in:
parent
154951a058
commit
ed52e9d03e
@ -145,9 +145,18 @@ namespace Nikse.SubtitleEdit
|
||||
|
||||
NoBreakAfterItem item;
|
||||
if (radioButtonText.Checked)
|
||||
{
|
||||
item = new NoBreakAfterItem(textBoxNoBreakAfter.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Utilities.IsValidRegex(textBoxNoBreakAfter.Text))
|
||||
{
|
||||
MessageBox.Show(Configuration.Settings.Language.General.RegularExpressionIsNotValid);
|
||||
return;
|
||||
}
|
||||
item = new NoBreakAfterItem(new Regex(textBoxNoBreakAfter.Text), textBoxNoBreakAfter.Text);
|
||||
}
|
||||
|
||||
foreach (NoBreakAfterItem nbai in _noBreakAfterList)
|
||||
{
|
||||
@ -168,7 +177,7 @@ namespace Nikse.SubtitleEdit
|
||||
_noBreakAfterList.Add(item);
|
||||
comboBoxDictionaries.Enabled = false;
|
||||
ShowBreakAfterList(_noBreakAfterList);
|
||||
for (int i = 0; i < listBoxNoBreakAfter.Items.Count; i++ )
|
||||
for (int i = 0; i < listBoxNoBreakAfter.Items.Count; i++)
|
||||
{
|
||||
if (listBoxNoBreakAfter.Items[i].ToString() == item.Text)
|
||||
{
|
||||
@ -189,22 +198,22 @@ namespace Nikse.SubtitleEdit
|
||||
|
||||
private void listBoxNamesEtc_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
int idx = listBoxNoBreakAfter.SelectedIndex;
|
||||
if (idx >= 0 && idx < _noBreakAfterList.Count)
|
||||
{
|
||||
NoBreakAfterItem item = _noBreakAfterList[idx];
|
||||
textBoxNoBreakAfter.Text = item.Text;
|
||||
if (item.Regex != null)
|
||||
{
|
||||
radioButtonRegEx.Checked = false;
|
||||
radioButtonText.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
radioButtonRegEx.Checked = true;
|
||||
radioButtonText.Checked = false;
|
||||
}
|
||||
}
|
||||
int idx = listBoxNoBreakAfter.SelectedIndex;
|
||||
if (idx >= 0 && idx < _noBreakAfterList.Count)
|
||||
{
|
||||
NoBreakAfterItem item = _noBreakAfterList[idx];
|
||||
textBoxNoBreakAfter.Text = item.Text;
|
||||
if (item.Regex != null)
|
||||
{
|
||||
radioButtonRegEx.Checked = false;
|
||||
radioButtonText.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
radioButtonRegEx.Checked = true;
|
||||
radioButtonText.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void textBoxNoBreakAfter_KeyDown(object sender, KeyEventArgs e)
|
||||
|
@ -872,7 +872,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
s = s.Replace("</p>", string.Empty);
|
||||
s = s.Replace("</P>", string.Empty);
|
||||
s = s.Replace("<P>", string.Empty);
|
||||
s = s.Replace("<p>", string.Empty);
|
||||
s = s.Replace("<P>", string.Empty);
|
||||
while (s.ToLower().Contains("<p "))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user