Don't clear undo history when applying draft

Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
This commit is contained in:
Viktor Oreshkin 2017-06-20 23:01:10 +03:00 committed by John Preston
parent 60c84bbf51
commit 68ddabea5c
2 changed files with 5 additions and 5 deletions

View File

@ -1715,10 +1715,10 @@ void HistoryWidget::fastShowAtEnd(History *h) {
}
}
void HistoryWidget::applyDraft(bool parseLinks) {
void HistoryWidget::applyDraft(bool parseLinks, Ui::FlatTextarea::UndoHistoryAction undoHistoryAction) {
auto draft = _history ? _history->draft() : nullptr;
if (!draft || !canWriteMessage()) {
clearFieldText();
clearFieldText(0, undoHistoryAction);
_field->setFocus();
_replyEditMsg = nullptr;
_editMsgId = _replyToId = 0;
@ -1726,7 +1726,7 @@ void HistoryWidget::applyDraft(bool parseLinks) {
}
_textUpdateEvents = 0;
setFieldText(draft->textWithTags);
setFieldText(draft->textWithTags, 0, undoHistoryAction);
_field->setFocus();
draft->cursor.applyTo(_field);
_textUpdateEvents = TextUpdateEvent::SaveDraft | TextUpdateEvent::SendTyping;
@ -1753,7 +1753,7 @@ void HistoryWidget::applyDraft(bool parseLinks) {
void HistoryWidget::applyCloudDraft(History *history) {
if (_history == history && !_editMsgId) {
applyDraft();
applyDraft(true, Ui::FlatTextarea::AddToUndoHistory);
updateControlsVisibility();
updateControlsGeometry();

View File

@ -301,7 +301,7 @@ public:
DragState getDragState(const QMimeData *d);
void fastShowAtEnd(History *h);
void applyDraft(bool parseLinks = true);
void applyDraft(bool parseLinks = true, Ui::FlatTextarea::UndoHistoryAction undoHistoryAction = Ui::FlatTextarea::ClearUndoHistory);
void showHistory(const PeerId &peer, MsgId showAtMsgId, bool reload = false);
void clearDelayedShowAt();
void clearAllLoadRequests();