About default preformatted text

Dear Developer,

When I copy and paste text, I often encounter issues with the formatting changing. For instance, when I copy a docker-compose.yml file, the original spaces decrease , even when I select text mode.

My wish is to create a faithful text editing block, and then in the system settings, set this block as the default text format.

text mode copy paste example:


yml mode ,looks good

copy from yml mode then paste to text editor, changed


Does this also happen if you choose Edit > Paste As > Preformatted ?

Yes.it’s easy to try.

1.vi docker-compose.yml copy the code
2.edit-paste as yml / text
3.copy back the text in agenda block
4. vi a new file then paste to it
5.text changed

It looks to me that the one that looks bad is not preformatted. When you copy code, it is best to paste in a preformatted style so that each letter is the same width. You can use the Edit > Paste As > Preformatted menu for that. Note that this is different to just pasting normally.

(BTW I think yml looks OK because the editor is putting rich text on the clipboard in that case, and not in the other case.)