# Can't save edited message that use code markdown

**URL:** <https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122>\
**Category:** Troubleshooting\
**Created:** [September 23, 2022, 10:35am UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122 "2022-09-23T10:35:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TearsOfSky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/tearsofsky/32/5929_2.png) [@TearsOfSky](https://forum.mattermost.com/u/TearsOfSky)\
**Post date:** [September 23, 2022, 10:35am UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122/1 "2022-09-23T10:35:56Z")

</div>

Step to reproduce :

- **send** a message (eg. a small code snippet)
- **edit** that message and add markdown code block (`your code`)
- press enter to save again

Expected : the message is saved

What happened : it keeps jump to a new line and there is no way to save  
 ![Capture d’écran du 2022-09-23 12-31-09](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/9/923dc2feffa5e13c7ae28e76ce9206365763f438.png)

Same behavior with the software client and the web client.

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [September 23, 2022, 11:01am UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122/2 "2022-09-23T11:01:06Z")

</div>

Hi TearsOfSky and welcome to the Mattermost forums!

I’m unable to follow your reproduction instructions, sorry.  
So on the desktop client you can send a message using the code block formatting just fine. Afterwards, when you want to edit this message and add an additional line to it, f.ex., you’re then unable to save it, is that correct? If so, I’m unable to reproduce that on my test systems here.

What mattermost server version are you using?  
What mattermost desktop client version are you using?  
What operating system are you working on?

---

<div class="post-metadata">

**Author:** ![TearsOfSky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/tearsofsky/32/5929_2.png) [@TearsOfSky](https://forum.mattermost.com/u/TearsOfSky)\
**Post date:** [September 23, 2022, 11:47am UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122/3 "2022-09-23T11:47:32Z")

</div>

Hello agriesser,

Not exactly.

You send a message in plaintext, without formatting it. Then, you edit that message and you add the code block, and you try to save it again.

Server : 6.6.1  
Desktop : 5.1.1, also tried with the web client  
OS : Debian Buster 10

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [September 23, 2022, 11:52am UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122/4 "2022-09-23T11:52:52Z")

</div>

Step 1: Enter text without formatting  
 ![grafik](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/3/30fec9f606f6285c39e39422dc3776851b534834.png)

Step 2: Start editing  
 ![grafik](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/3/3a15f91788896b841372cfeafce5f18624043f4b.png)

Step 3: Finish editing and hit save  
 ![grafik](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/f/fb06656e8640f6cad5be75ed68f5b31275ccf397.png)

Result:  
 ![grafik](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/5/5d6dd6fa48bae818421f9e0f1a4854bf33ab2aef.png)

It seems as if the syntax detection does not work upon editing and defaults to some non-specific value, you can (however) force the syntax detection which will then make it look like you entered the code correctly right from the beginning:

Step 3, Method 2:  
 ![grafik](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/e/e43cfefe28405e175565cec38c248eb4d58970d0.png)

Result:  
 ![grafik](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/d/d57239f3526d331093481e537ced62614f37bd9f.png)

This has been tested on 7.2.0 - let me know if your experience differs from mine here and if so, in what step so I can try to spin up a 6.6.1 instance and try to dig a bit deeper here.

---

<div class="post-metadata">

**Author:** ![TearsOfSky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/tearsofsky/32/5929_2.png) [@TearsOfSky](https://forum.mattermost.com/u/TearsOfSky)\
**Post date:** [September 23, 2022, 12:02pm UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122/5 "2022-09-23T12:02:30Z")

</div>

Thank you for your answer.

I don’t have the “save” and “cancel” buttons in my version, probably because it was added in 7.2 : [Redirect](https://docs.mattermost.com/install/self-managed-changelog.html#release-v7-2-feature-release)

> - Added **Save** and **Cancel** buttons for post inline editing.

So, the only way for me to save a message is to press Enter.  
 ![Capture d’écran du 2022-09-23 13-59-44](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/6/65a4b000e9ee689d2afff3d1a66cd9359d94e0bb.png)

That’s why i’ve jumps in my initial message.

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [September 23, 2022, 12:26pm UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122/6 "2022-09-23T12:26:51Z")

</div>

Doesn’t really matter - the buttons just emulate the `ENTER`and `ESCAPE` events, but I booted my 6.6.1 installation now and found out that hitting ENTER did not close the box, but CTRL-ENTER does (the rest behaves exactly the same). So please just use CTRL-ENTER to close the box.

---

<div class="post-metadata">

**Author:** ![TearsOfSky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/tearsofsky/32/5929_2.png) [@TearsOfSky](https://forum.mattermost.com/u/TearsOfSky)\
**Post date:** [September 23, 2022, 12:36pm UTC](https://forum.mattermost.com/t/cant-save-edited-message-that-use-code-markdown/14122/7 "2022-09-23T12:36:02Z")

</div>

CTRL+Enter works, thank you !
