Skip to content

Commit

Permalink
Fix undo "Insert Date/Time" needs 2 times to get old data back issue
Browse files Browse the repository at this point in the history
Fix #12831
  • Loading branch information
donho committed Jan 22, 2023
1 parent 535bd8f commit 04f38a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PowerEditor/src/NppCommands.cpp
Expand Up @@ -95,9 +95,12 @@ void Notepad_plus::command(int id)
dateTimeStr += TEXT(" ");
dateTimeStr += dateStr;
}
_pEditView->execute(SCI_BEGINUNDOACTION);

_pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast<LPARAM>(""));
_pEditView->addGenericText(dateTimeStr.c_str());

_pEditView->execute(SCI_ENDUNDOACTION);
}
break;

Expand All @@ -109,8 +112,12 @@ void Notepad_plus::command(int id)
NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
generic_string dateTimeStr = getDateTimeStrFrom(nppGUI._dateTimeFormat, currentTime);

_pEditView->execute(SCI_BEGINUNDOACTION);

_pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast<LPARAM>(""));
_pEditView->addGenericText(dateTimeStr.c_str());

_pEditView->execute(SCI_ENDUNDOACTION);
}
break;

Expand Down

0 comments on commit 04f38a7

Please sign in to comment.