mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-29 01:52:48 +00:00
Don't clear undo history when applying draft
Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
This commit is contained in:
parent
60c84bbf51
commit
68ddabea5c
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user