Bug 89829 - Updating character style to match selection does not remove direct formatting
Summary: Updating character style to match selection does not remove direct formatting
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.1.1 rc
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks: Styles-Management Writer-Styles-Character
  Show dependency treegraph
 
Reported: 2015-03-04 21:02 UTC by mahfiaz
Modified: 2023-01-12 14:17 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Example document with instructions to replicate the issue (41.33 KB, application/vnd.oasis.opendocument.text)
2015-03-18 20:33 UTC, mahfiaz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mahfiaz 2015-03-04 21:02:01 UTC
1) Mark a few words with a character style
2) Select one word, change its color to e.g red
3) while word still selected update the character style (one would have to have character styles open in styles and formatting dialog and pick "update style" from the rightmost button in the dialog)
4) select another word, change its color to e.g blue
5) repeat 3
6) see that the first word is still red, since the local formatting was not removed (which works just fine with paragraph styles)


On the other hand this might be a pandora box and open another can of bugs, as how it should behave when the whole word is marked red, but when updating the character style only two letters are selected or even none at all. Should it expand the selection before removing properties? What if there are nonmatching regions, e.g
<b>this is <selection>bold <i>this</selection> is bold italic</b> this is italic</i>
Right now it would only update to bold, as the whole selection happens to be bold, but not whole it is italic.
Comment 1 mahfiaz 2015-03-18 20:33:52 UTC
Created attachment 114173 [details]
Example document with instructions to replicate the issue
Comment 2 Owen Genat (retired) 2015-03-18 23:36:25 UTC
Similar underlying issue as reported in bug 89960 (added to See Also list) i.e., directly applied formatting overrides/XORs all styles. Also changed "local" to "direct" in summary.
Comment 3 Yousuf Philips (jay) (retired) 2016-10-20 02:26:35 UTC
(In reply to mahfiaz from comment #0)
> 1) Mark a few words with a character style
> 2) Select one word, change its color to e.g red
> 3) while word still selected update the character style (one would have to
> have character styles open in styles and formatting dialog and pick "update
> style" from the rightmost button in the dialog)
> 4) select another word, change its color to e.g blue
> 5) repeat 3
> 6) see that the first word is still red, since the local formatting was not
> removed (which works just fine with paragraph styles)

In this case, where it is using the currently selected text to apply the formatting to the rest of text, it should remove the direct formatting, just like it does for the updation of paragraph styles.

> On the other hand this might be a pandora box and open another can of bugs,
> as how it should behave when the whole word is marked red, but when updating
> the character style only two letters are selected or even none at all.
> Should it expand the selection before removing properties? What if there are
> nonmatching regions, e.g
> <b>this is <selection>bold <i>this</selection> is bold italic</b> this is
> italic</i>
> Right now it would only update to bold, as the whole selection happens to be
> bold, but not whole it is italic.

Yes this issue needs some deep thought and research to find out what the best default option should be and likely we should have option dialog options to tweak its behavior to user preference, like

1) Clear all direct formatting on character styled text when updating style

from <charstyle><b>this is <i>some <u>text</i> and</u> some more<b></charstyle>
to <charstyle>this is some text and some more</charstyle>

2) Clear direct formatting that covers the entire text when updating style

from <charstyle><b>this is <i>some <u>text</i> and</u> some more<b></charstyle>
to <charstyle>this is <i>some <u>text</i> and</u> some more</charstyle>

3) Dont remove direct formatting when updating style (what we do now)

This issue is related to bug 85131 which talks about similar updation problems with paragraph styles.
Comment 4 QA Administrators 2018-05-24 02:45:29 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2020-05-24 03:43:21 UTC Comment hidden (obsolete)
Comment 6 sdc.blanco 2021-01-10 14:35:08 UTC
Repro steps 1-6 in OP

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 4041c68ea59181f1c4774c356809066d2051db41

As noted in step 6 and comment 3, the direct character formatting is not removed when the second "update style" is conducted.
Comment 7 QA Administrators 2023-01-11 03:23:29 UTC Comment hidden (obsolete)
Comment 8 sdc.blanco 2023-01-11 09:53:37 UTC
repro

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 98f0dd5e15733ac7f1d929d06ab230b5f04121d5
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: da-DK (da_DK); UI: en-US
Calc: CL threaded

But as noted in OP, comment 2, comment 3, maybe the expected behavior needs to be considered. Perhaps this case is NAB? Adding UXEval....
Comment 9 Heiko Tietze 2023-01-11 10:25:47 UTC
(In reply to Yousuf Philips (jay) (retired) from comment #3)
> In this case, where it is using the currently selected text to apply the
> formatting to the rest of text, it should remove the direct formatting, just
> like it does for the updation of paragraph styles.

Two paragraphs, both using Text Body. Set font name for P1 to "Foo" and change the style. P1 will overwrite via direct formatting the "Foo" font name with "Foo".

(In reply to mahfiaz from comment #0)
> On the other hand this might be a pandora box and open another can of bugs,
> as how it should behave when the whole word is marked red, but when updating
> the character style only two letters are selected or even none at all.

Good example to resolve NAB/WF.