Fix undo "Insert Date/Time" needs 2 times to get old data back issue

Fix #12831
This commit is contained in:
Don Ho 2023-01-22 03:56:43 +01:00
parent 535bd8fa0e
commit 04f38a7af0

View File

@ -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;
@ -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;