Do not count alignment tags in line length (or chars/min)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1575 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-01-22 18:17:40 +00:00
parent f93a4616dc
commit f8029920db
3 changed files with 27 additions and 3 deletions

View File

@ -5749,6 +5749,13 @@ namespace Nikse.SubtitleEdit.Forms
buttonSplitLine.Visible = false;
string s = Utilities.RemoveHtmlTags(text).Replace(Environment.NewLine, string.Empty); // we don't count new line in total length... correct?
if (s.StartsWith("{\\"))
{
int k = s.IndexOf("}");
if (k < 10)
s = s.Remove(0, k + 1);
}
if (s.Length < Configuration.Settings.General.SubtitleLineMaximumLength * 1.9)
{
lineTotal.ForeColor = Color.Black;
@ -14954,6 +14961,8 @@ namespace Nikse.SubtitleEdit.Forms
if ((DateTime.Now.Ticks - _listViewTextTicks) > 10000 * 700) // only if last typed char was entered > 700 milliseconds
{
if (index < 0 || index >= _subtitle.Paragraphs.Count)
return;
string newText = _subtitle.Paragraphs[index].Text.TrimEnd();
string oldText = _listViewTextUndoLast;
if (oldText == null)
@ -14962,7 +14971,9 @@ namespace Nikse.SubtitleEdit.Forms
if (_listViewTextUndoLast != newText)
{
MakeHistoryForUndo(Configuration.Settings.Language.General.Text + ": " + _listViewTextUndoLast.TrimEnd() + " -> " + newText, false);
_subtitle.HistoryItems[_subtitle.HistoryItems.Count - 1].Subtitle.Paragraphs[index].Text = _listViewTextUndoLast;
int hidx = _subtitle.HistoryItems.Count - 1;
if (hidx >= 0 && hidx < _subtitle.HistoryItems.Count)
_subtitle.HistoryItems[hidx].Subtitle.Paragraphs[index].Text = _listViewTextUndoLast;
_listViewTextUndoLast = newText;
_listViewTextUndoIndex = -1;
@ -15014,7 +15025,14 @@ namespace Nikse.SubtitleEdit.Forms
int extraNewLineLength = Environment.NewLine.Length - 1;
int lineBreakPos = textBox.Text.IndexOf(Environment.NewLine);
int pos = textBox.SelectionStart;
int totalLength = Utilities.RemoveHtmlTags(textBox.Text).Replace(Environment.NewLine, string.Empty).Length; // we don't count new line in total length... correct?
var s = Utilities.RemoveHtmlTags(textBox.Text).Replace(Environment.NewLine, string.Empty); // we don't count new line in total length... correct?
if (s.StartsWith("{\\"))
{
int k = s.IndexOf("}");
if (k < 10)
s = s.Remove(0, k + 1);
}
int totalLength = s.Length;
string totalL = " " + string.Format(_languageGeneral.TotalLengthX, totalLength);
if (lineBreakPos == -1 || pos <= lineBreakPos)
{

View File

@ -681,7 +681,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAASABHAEgARwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAATABHAEwARwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -1599,6 +1599,12 @@ namespace Nikse.SubtitleEdit.Logic
{
label.ForeColor = Color.Black;
string cleanText = Utilities.RemoveHtmlTags(text).Replace(Environment.NewLine, "|");
if (cleanText.StartsWith("{\\"))
{
int k = cleanText.IndexOf("}");
if (k < 10)
cleanText = cleanText.Remove(0, k + 1);
}
string[] lines = cleanText.Split('|');
const int max = 3;