Format is messed up when replacing text

@ajlittoz @EarnestAl
I found out what the issue is with the italics words, it’s the regular space preceding them. If I style the space as italics, the first character of the newly typed word is italics too. But I can’t use the find and replace trick for this one, because I should replace preceding each italics word. How can I work around this?

Reduce a copy of your file to two paragraphs, and share here to test. Thanks.


Now I suppose that it can be a corruption of the user profile.

Yes, you can:
Find: (?<=^[:digit:])([:space:])
imagen

1 Like

Could it be a corruption of the document itself? This doesn’t happen on other documents, I requested a copy of the same document as .docx and it doesn’t happen there, only on the .odt of this document. Very weird

test.odt (6.0 KB)

This is an example with the same formatting. The word “said” is styled italics, if you double-click it to select and then start typing to replace it, the new word’s first character will be regular, the rest will be italics.

You have an awful mixture of styling and direct formatting. You tweaked your paragraph styles in a weird way: Normalny is the root for a new hierarchy: it is not a descendant of Default Paragraph Style. Is it possible you converted the document from DOCX or created it in Word? The derived style Zwykly Tekst changes the font to Courier.

You applied character style Domyślna czcionka akapitu which adds absolutely no attribute; so, you could as well remove its application.

The rest is done with direct formatting: initial number to bold, word “said” italic.

Following your procedure on original text, I get the same result as you. But after clearing direct formatting and applying Emphasis on “said”, everything is back to normal:

  • putting the cursor at left of said (space at left has no character style), typing is regular
  • selecting “said” word, replacement is italic, as dictated by character style Emphasis

Don’t mix styling and direct formatting. Getting expected, stable and reliable results with direct formatting requires super-guru expert skills, contrary to popular belief. Styles are your friends.

Yes, I know, there are no such styles in Word and M$ conditioned us into believing Word is the ultimate tool.

Delete the Normalny style, save and reopen, and the issue will be gone.
{60AD47DD-9AF6-45FC-8B03-0C467E12FD20}

{CC32D1B5-1EA5-4F74-BC55-C2B7C399D85D}

I didn’t do anything, I got this very big document and must edit it. I don’t even know how to see the things you are talking about.

It could very possibly be the case, I’m just a monkey on a typewriter.

I spent a long time convincing people of the superiority of open formats, it would suck to now tell them to use .docx again.

If I switch to Default paragraph style the formatting changes (the indentation disappears, I don’t know what else) and the issue persists.

If the text is selected and No Character Style is applied (or Emphasis but not using the character style Domyślna czcionka akapitu), then double clicking said and typing this makes a correct replacement giving this

So is it just a broken document? Since styles appear in Polish even though the system language is English

I would not say it is a broken document. Likely, it has a complicated editing history without careful attention paid to it.

And text is flagged as it_IT, i.e. Italian !

Don’t do that! Always use the native format in any application. If you have Writer, work in .odt. But if your company provides Word, then work .docx but be aware that editing a .docx document with Writer, even only occasionally, will damage it because of the conversions at open and save times.

I fully support your campaign in favour of open formats, but this is not enough. You must also adhere to a methodology in line with the document management model, i.e.styles. The document shows direct formatting (DF). DF, encouraged by Word by lack of adequate features, is the same as using advanced computers like mechanical typewriters. Only styles will liberate you from this burden and reward you with freedom of formatting, versatility and power.

Do you see all that info in the status bars? I need to fix a lot of things here.

Thank you for your tip about styles, unfortunately documentation about them is a little lacking (or maybe I’m just dumb), do you know of a good resource to learn about them?

Perhaps start with Writer Guide 24.2, especially chapters 8 and 9.

2 Likes

It depends on what you call “status bars”. My main diagnostic tool is the Style Inspector (6th icon-button below the triple-line icon) in the right side pane. I also right-click on a style name and Edit to access all properties.

@robleyd gave a link to the Writer Guide. It describes how to use Writer. At the same location you can also download Bruce Byfields’s Designing with LibreOffice which focuses on styling.

This is a bug, and a regression. It worked fine in 7.2; it was broken in 7.3 so that typing over said would be non-italicised; and finally, in 7.4, it started working as you describe.

It needs to be filed.

I’m not sure how to properly explain it in a bug report, I took several posts just to make it barely comprehensible.

You did 100% of what was needed from start, in your post where you provided the sample. Basically, that was everything you needed to do initially. Even the accompanying description there is everything that was needed.

It might be a little bit more complicated, I tested with a .docx version of the document, the issue doesn’t happen. Instead, the newly typed word is Regular. But if I use regular expressions to find and replace all italic character with italic characters (see screenshot) the issue disappears completely, newly typed words are styled italic as expected.
RegEx

It doesn’t matter. You provide a sample file; you provide exact steps how it misbehaves. This is a bug, and nothing else matters in frame of the bug (well, additional information may help nail it down, but it wouldn’t invalidate the bug itself).

Anyway, that’s tdf#79717, which got worse after some changes (I commented there).