A. To preserve formatting, copy the formatted text before editing, then paste it back after making your changes. Use a text editor that supports formatting to make edits before pasting back into the chat.
B. Consider using markdown or other text formatting tools to manually reapply formatting after editing messages.