Skip to content

Commit

Permalink
more undo/redo stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Mar 22, 2024
1 parent 32dcd37 commit 535c982
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vstgui/lib/ctexteditor.cpp
Expand Up @@ -1234,6 +1234,7 @@ void TextEditorView::onKeyboardEvent (KeyboardEvent& event)
}
case VirtualKey::Return:
{
checkCurrentUndoGroup (true);
insertNewLine ();
event.consumed = true;
return;
Expand Down Expand Up @@ -2724,7 +2725,7 @@ void TextEditorView::setFindString (String&& text) const
void TextEditorView::checkCurrentUndoGroup (bool force) const
{
auto currentTime = getPlatformFactory ().getTicks ();
if (force || (md.currentUndoGroup.time > 0 && md.currentUndoGroup.time < currentTime - 500))
if (force || (md.currentUndoGroup.time > 0 && md.currentUndoGroup.time < currentTime - 250))
{
if (md.currentUndoGroup.record.empty ())
return;
Expand All @@ -2735,7 +2736,8 @@ void TextEditorView::checkCurrentUndoGroup (bool force) const
--md.undoPos;
md.currentUndoGroup = {};
}
md.currentUndoGroup.time = currentTime;
if (!force || md.currentUndoGroup.time != 0)
md.currentUndoGroup.time = currentTime;
}

//------------------------------------------------------------------------
Expand Down

0 comments on commit 535c982

Please sign in to comment.