Bug 79717 - EDITING: Overwriting selected text doesn't always maintain formatting
Summary: EDITING: Overwriting selected text doesn't always maintain formatting
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: BSA target:6.3.0 target:7.1.0 target:...
Keywords:
: 95312 112961 (view as bug list)
Depends on:
Blocks: Character Formatting-Text-Diverse
  Show dependency treegraph
 
Reported: 2014-06-06 10:39 UTC by Patrick Moody
Modified: 2024-10-05 08:02 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Moody 2014-06-06 10:39:38 UTC
Problem description: 
Selecting text then typing over it uses the formatting from the preceding (to the left) text, rather than maintaining the formatting of the text that is being replaced.


Steps to reproduce:
1. In a document with a line of normal text followed by a some bold type text.
2. Make a selection from the start of the bold type text (where normal type is to the left of it and bold is to the right) to some point within the bold text but not up to the end of it.
3. Type in some new text to replace that which was selected.

Current behaviour:
The new text is not bold, but has the same format of the existing text to the left of it.


Expected behaviour:
The new text maintains the formatting of the text that it is replacing.
              
Operating System: Windows 7
Version: 4.2.2.1 release
Comment 1 Yousuf Philips (jay) (retired) 2014-06-06 19:44:14 UTC
Confirmed in Linux Mint in 3.3.0, 4.2.4 and 4.3 beta.

Steps:
1. type 'abcdefg'
2. press Ctrl+B
3. type 'hijklmn'
4. highlight 'hijk'
5. type any number of characters
6. characters typed arent bold
Comment 2 QA Administrators 2015-06-08 14:41:34 UTC Comment hidden (obsolete)
Comment 3 Buovjaga 2015-06-21 17:14:44 UTC
Repro.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 3ecef8cedb215e49237a11607197edc91639bfcd
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-06-19_23:16:58
Locale: fi-FI (fi_FI)
Comment 4 Buovjaga 2015-10-26 08:35:42 UTC
*** Bug 95312 has been marked as a duplicate of this bug. ***
Comment 5 QA Administrators 2016-11-08 11:53:08 UTC Comment hidden (obsolete)
Comment 6 Phil Krylov 2019-02-10 19:15:15 UTC
*** Bug 112961 has been marked as a duplicate of this bug. ***
Comment 7 Commit Notification 2019-03-13 10:29:19 UTC
Phil Krylov committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/6abed0ea006f3616e40faf2ae782cf64f8ac2914%5E%21

tdf#79717 save/restore character format on selection overwrite

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Buovjaga 2019-03-20 18:40:16 UTC
Phil: I verify the fix. Should this be set to resolved?

Arch Linux 64-bit
Version: 6.3.0.0.alpha0+
Build ID: 0c7009e751a5c8b3c5f73ac42fad5b4954206fc1
CPU threads: 8; OS: Linux 5.0; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 17 March 2019
Comment 9 Phil Krylov 2019-03-20 20:57:22 UTC
(In reply to Buovjaga from comment #8)
> Phil: I verify the fix. Should this be set to resolved?

The issue actually seems to be somewhat bigger.

First, it also applies not only to direct formatting, but also to character styles. For this I've posted a simple extension of the accepted patch, which is now on review queue at https://gerrit.libreoffice.org/69323 .

Then, these patches do fix the problem with direct user input, but do not seem to fix the same problem appearing when replacing text via UNO API (with portion/cursor setString method) or from a spelling suggestion context menu. I am going to further investigate this problem when time permits; probably separate issue numbers should be used (I have now found bug 51423, bug 99786, bug 104137 which probably should be marked duplicates of 51423; but found no filed issue for the UNO API behavior) although they are all clearly related. I've also met this behaviour with Find&Replace, but that seems to be fixed recently.
Comment 10 Buovjaga 2019-03-21 06:54:48 UTC
Ok, thanks a lot! If you get stuck, feel free to email the dev list for assistance.
Comment 11 Commit Notification 2019-03-21 07:14:49 UTC
Phil Krylov committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/04bd1925706360414438b814046b543c5e317d0a%5E%21

tdf#79717 save/restore character style on selection overwrite

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Xisco Faulí 2019-05-16 10:33:07 UTC Comment hidden (obsolete)
Comment 13 Luke Kendall 2019-05-23 12:49:38 UTC Comment hidden (obsolete)
Comment 14 Xisco Faulí 2019-05-23 13:23:13 UTC Comment hidden (obsolete)
Comment 15 Thomas Lendo 2020-08-24 19:09:10 UTC
I can't reproduce the steps in comment 0 and comment 1, so I think this bug is fixed?

Tested with
Version: 7.1.0.0.alpha0+
Build ID: a06a83b29a9da770787bffe416b138102aa12531
CPU threads: 2; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: de-AT (de_AT.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2020-08-24_01:03:26
Calc: CL


Phil Krylov, for the several bugs of overwriting/pasting of text and losing of formatting please see meta bug 127250 (Formatting-Text-Diverse) - [META] Text formatting issues when inserting or overwriting.
Comment 16 Thomas Lendo 2020-08-24 19:13:40 UTC
*** Bug 79364 has been marked as a duplicate of this bug. ***
Comment 17 Commit Notification 2020-11-04 21:35:31 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b05955b480fe4d32852e7be8a118d46ca7e6dbfa

tdf#79717: sw_uiwriter: Add unittest

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2021-10-14 06:46:28 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/036d45b602c2f554f9bcc21fecbc3e3ac5b834da

tdf#134426 tdf#138873 sw:  Revert "tdf#79717 ...

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2021-10-14 08:18:54 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/49e8691530ea931eeee74fd88727c2451e98a3bd

tdf#134426 tdf#138873 sw:  Revert "tdf#79717 ...

It will be available in 7.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2021-10-14 10:24:34 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/08ede5d51a33f83ededee8a03c10f9bb8244690e

tdf#134426 tdf#138873 sw:  Revert "tdf#79717 ...

It will be available in 7.1.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Justin L 2021-10-14 10:36:21 UTC
Previous attempt was reverted because it was spamming direct formatting.
Comment 22 Mike Kaganski 2024-10-05 08:02:23 UTC
Commit 0c3b89da7cde9866bf3174a6276736c76efb8356 could have a logic useful to fix this.

Note that after commit 17b39d150fce188f653632a3467891157375a1c6, this bug became worse, because now following steps in comment 1, but selecting 'hijklmn' in step 4, would also misbehave, unlike previously.