Custom style is overridden by Text Body Indent when I hit enter

I created a new style (monospace, indented) for code. I can select the ‘Code’ style and enter some text, and it appears correctly. When I hit ‘Enter’, selected style under the cursor is still ‘Code’, but the previous line I typed immediately switches to the style “Text Body Indent”. Every time I hit enter, the previous line changes. This happens even if I turn off auto-correct.

Why does it do this?
How do I turn this behavior off?

Please designate your exact version of LibO. In V7.2.0.1RC e.g. there is a little bug conncerning the style shown in the sidebar which may be “selected”, but not applied.
To apply a paragraph style to the current paragraph (or the selection) you need to not only “select” it in the stylist, but to apply it with a doubleclick.

1 Like

I’m not at my computer right now but I’ll add the version later. (For what it’s worth, I’m using Ubuntu 20.04, and it’s the latest version available in the repo).

Anyway, the known bug you describe doesn’t match my issue. When I hit enter, libreoffice adds a new line with the correct style, but changes the style of the text on the previous line. It changes it in the style selector and applies the change in the editor.

An attached example showing the issue might help. What you describe looks extremely strange to me.
Just one thing: Hitting Enter doesn’t create a new line, but a new paragraph. Well, paragraphs start with a new line, each.

Is your Code style actually a paragraph style or were you talkng about a character style? Please note the relevant difference. (MS Word doesn’t know about character styles, I was told.)

It’s a paragraph style. I agree that it’s extremely strange behaviour. I am familiar with other text apps that switch back to the default paragraph style every time you hit enter. This would affect the new paragraph. But my issue is that Libreoffice is changing the line on which enter was pressed (ie, not the new paragraph style, but the line above it).