zevlg / telega.el

GNU Emacs telegram client (unofficial)
https://zevlg.github.io/telega.el/
GNU General Public License v3.0
1.09k stars 85 forks source link

Content of the input part in telega-chat-mode is lost when executing `telega-chatbuf-edit-prev` #336

Open rodrigomorales1 opened 2 years ago

rodrigomorales1 commented 2 years ago

Telega Setup

Emacs:

ELISP> (emacs-version)
"GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4)
 of 2021-03-26"

Telega

ELISP> (telega-version)
"telega v0.7.100 (TDLib v1.7.10) (telega-server v0.7.13)"

Current Behavior

The content of the input part is in a buffer whose major mode is telega-chat-mode is lost when executing telega-chatbuf-edit-prev (M-p). I think this is undesired behavior because suppose I write a long message and I accidentally execute telega-chatbuf-edit-prev (M-p), my message would be lost.

Steps to Reproduce

  1. Send a message in a buffer whose major mode is telega-chat-mode
  2. Now, write a new message but don't send it
  3. Execute telega-chatbuf-edit-prev (M-p)

At this point, the message that you initially typed has been lost. If you execute undo (C-/), the message will not be recovered.

Possible Solution

A possible solution would be that the content of the input box is stored somewhere before it gets deleted. Once the edit is cancelled, the message that was previously there is shown.