ayn2op / discordo

A lightweight, secure, and feature-rich Discord terminal client.
MIT License
2.12k stars 66 forks source link

Fix issues when swapping between Message Input and EDITOR #363

Closed cyberme0w closed 6 months ago

cyberme0w commented 6 months ago

Hi!

This PR fixes two issues I noticed when swapping between the Message Input and EDITOR:

  1. The EDITOR is initialized empty (CreateTemp generates an empty file), even if the user had already typed something.
  2. When returning from the EDITOR, a newline is appended for some reason (tested with neovim and nano)

Issue 1 is solved by writing the contents of the Message Input to the temp file. Issue 2 is solved by trimming leading and trailing whitespace, as Discord already does that after the message is sent.

Cheers!

ayn2op commented 6 months ago

Thank you!