Fixed bug undo (Ctrl+z invoked very fast after a change)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@855 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-12-24 12:16:16 +00:00
parent 9c0dcdb4c7
commit af507a98f4
2 changed files with 17 additions and 5 deletions

View File

@ -14,13 +14,13 @@ Subtitle Edit Changelog
Now includes (some) italic detection + adds support for
Arabic, Hebrew, Hindi, and Thai
* Undo improved so it also works for textbox + redo (Ctrl+Y)
* Many new configurable shortcuts
* OCR tweaked a bit + BluRay sup files are processed faster
* TextBox with current subtitle now shows cursor position - thx Leszek
* Subtitle format PAC much improved
* Subtitle format FCP Xml improved - thx Ulrik
* Subtitle format D-Cinema improved - thx Karam
* Splitting of lines - Thx Trottel
* More configurable shortcuts
* FIXED:
* Fixed crash when setting Options - thx karmazyn
* Fixed crash in set color (or set font) - thx LEO33

View File

@ -3682,8 +3682,21 @@ namespace Nikse.SubtitleEdit.Forms
UndoToIndex(true);
}
/// <summary>
/// Undo or Redo
/// </summary>
/// <param name="undo">True equals undo, false triggers redo</param>
private void UndoToIndex(bool undo)
{
// Add latest changes if any (also stop changes from being added while redoing/undoing)
timerTextUndo.Stop();
timerAlternateTextUndo.Stop();
_listViewTextTicks = 0;
_listViewAlternateTextTicks = 0;
timerTextUndo_Tick(null, null);
timerAlternateTextUndo_Tick(null, null);
int selectedIndex = FirstSelectedIndex;
string text = string.Empty;
if (undo)
@ -3731,9 +3744,6 @@ namespace Nikse.SubtitleEdit.Forms
_fileName = _subtitle.UndoHistory(_undoIndex, out subtitleFormatFriendlyName, out _fileDateTime, out _subtitleAlternate, out _subtitleAlternateFileName);
if (!undo)
{
if (_subtitle.HistoryItems[_undoIndex].RedoParagraphs == null) //TODO: why? Fast keypresses?
return;
_subtitle.Paragraphs.Clear();
if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null)
_subtitleAlternate.Paragraphs.Clear();
@ -3787,8 +3797,10 @@ namespace Nikse.SubtitleEdit.Forms
if (_subtitleAlternate != null && _subtitle.HistoryItems[_undoIndex].RedoLineIndex >= 0 && _subtitle.HistoryItems[_undoIndex].RedoLineIndex == FirstSelectedIndex)
textBoxListViewTextAlternate.SelectionStart = _subtitle.HistoryItems[_undoIndex].RedoLinePositionAlternate;
ShowStatus("Redo performed"); //TODO:WORKING ON UNDO
ShowStatus("Redo performed"); //TODO: do not hardcode text... SE 3.3
}
timerTextUndo.Start();
timerAlternateTextUndo.Start();
}
private void RedoLastAction()