mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Don't allow very long texts in waveform due to performance - thx Skrity :)
Fix #2536
This commit is contained in:
parent
40f6be44e8
commit
a43f8a1c48
@ -746,10 +746,17 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
if (Configuration.Settings.General.RightToLeftMode && LanguageAutoDetect.CouldBeRightToLeftLanguge(new Subtitle(_displayableParagraphs)))
|
||||
text = Utilities.ReverseStartAndEndingForRightToLeft(text);
|
||||
int removeLength = 1;
|
||||
if (text.Length > 500)
|
||||
text = text.Substring(0, 500); // don't now allow very long texts as they can make SE unresponsive - see https://github.com/SubtitleEdit/subtitleedit/issues/2536
|
||||
while (text.Length > removeLength && graphics.MeasureString(text, font).Width > currentRegionWidth - padding - 1)
|
||||
{
|
||||
text = text.Remove(text.Length - removeLength).TrimEnd() + "…";
|
||||
removeLength = 2;
|
||||
if (text.Length > 200)
|
||||
removeLength = 21;
|
||||
else if (text.Length > 100)
|
||||
removeLength = 11;
|
||||
else
|
||||
removeLength = 2;
|
||||
}
|
||||
drawStringOutlined(text, currentRegionLeft + padding, padding);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user