Bug 139631 - Inconsistent removal of preceding space when cutting word with track changes on (comment 7)
Summary: Inconsistent removal of preceding space when cutting word with track changes ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:24.8.0 target:24.2.1 target:25...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Undo-Redo Cut-Copy redlinehide-regressions
  Show dependency treegraph
 
Reported: 2021-01-15 10:29 UTC by Telesto
Modified: 2024-11-06 10:27 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (10.78 KB, application/vnd.oasis.opendocument.text)
2021-01-15 10:29 UTC, Telesto
Details
Different example same effect (9.13 KB, application/vnd.oasis.opendocument.text)
2021-01-18 19:32 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2021-01-15 10:29:42 UTC
Description:
Cut is cutting outside the selected range

Steps to Reproduce:
1. Open the attached file
2. Select the yellow highlight text.. except the first spacing.. so starting at 'f' of four. Until the point (without . included)
3. CTRL+X

Press CTRL+Z. No include the . in the selection.. no it does I would expect in the first place

Actual Results:
Yellow marking gone in full

Expected Results:
Should remain small block with yellow marking


Reproducible: Always


User Profile Reset: No



Additional Info:
Found in
Version: 7.2.0.0.alpha0+ (x64)
Build ID: f2171af6ce3516598d9f8bac8294025a21a5b1a2
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL

and in
4.4.7.2

and in
4.3

but not in
4.2
Comment 1 Telesto 2021-01-15 10:29:54 UTC
Created attachment 168902 [details]
Example file
Comment 2 mulla.tasanim 2021-01-15 17:49:37 UTC
Thank you for reporting the bug.

I can confirm the bug present in

Version: 7.0.3.1 (x64)
Build ID: d7547858d014d4cf69878db179d326fc3483e082
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 761a672d62df1891b9f4f367a499b220ab2b33fa
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 3 Telesto 2021-01-18 19:32:59 UTC
Created attachment 168998 [details]
Different example same effect

Select the yellow marked area
Comment 4 Telesto 2021-01-18 19:36:51 UTC
@Buovjaga
If you're in the mood of doing a 'skippy' hard bibisect.. I got made few mistake while bibisect.. and got bored.. and LibO kept continue crashing or not opening at all (with gen backend). So not sure if even possible to get something useful

Could have copy/pasted the demo also if opening failed.. Anyhow did try really hard

I might look into it someday
Comment 5 Justin L 2021-01-19 09:26:55 UTC
I used Linux's bibisect-43max. There is a range of about 550 commits where the document wouldn't load until 'Revert "impl. enumeration for ZipPackage"', and then a few more commits until the main text re-appeared (thanks to 'Support for singleton constructor functions').

https://cgit.freedesktop.org/libreoffice/core/log/?id=c0864f26f3143ea81c65d3826fae32a8fd54c531&qt=range&q=94227ec32e4736d4a85e4d82be195eaef5ce45f1..997d21183322a0a94b96868073808841d2773902

There are lots of commits dealing with string length, and comments...

P.S. I found the description a bit confusing - too much irrelevant information. I focused on the fact that the leading space was selected as part of the deletion, and the undo showed the leading space included in the selection.

I almost wouldn't call this a bug, since in most cases, connecting the fullstop to the end of the previous word would be the general user intention.
Comment 6 Telesto 2021-01-19 09:40:46 UTC
(In reply to Justin L from comment #5)
> I almost wouldn't call this a bug, since in most cases, connecting the
> fullstop to the end of the previous word would be the general user intention.

This kind of 'feature' shouldn't be hardcoded somewhere. It it will eat 'explicit' set formatting -red formatting -  attachment 168998 [details]

Also not working consistently: replace the ! attachment 168998 [details] by '.' and select & cut the yellow text next.. now it works as I would expect it to work

I really dislike an Office Suite knowing what. Prefer to be in control :P

So if this somehow 'wanted' it should be done by auto-correct, IMHO
Comment 7 QA Administrators 2023-01-20 03:24:57 UTC Comment hidden (obsolete)
Comment 8 Stéphane Guillou (stragu) 2023-12-01 09:56:28 UTC
Same as Justin, I wouldn't consider the removal of the preceding space as a bug, it's more of a convenience feature for people wanting to cut a word without ending up with useless or duplicated space.
Ctrl + Z does restore it as expected.
And the conversation is better had in bug 141738.

However, there is certainly some inconsistency, and that would be a bug:

1. Open attachment 168998 [details]
2. Cut yellow highlight: preceding space removed
3. Ctrl + Z: space restored
4. Change exclamation point to a full stop
5. Cut yellow highlight: preceding space not removed!
6. Ctrl + Z
7. Change back to exclamation point
8. Cut yellow highlight: preceding space still not removed!

So let's change the focus of this report.

Reproduced in recent trunk build:

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 5589659829f8a1cef8ca1c8a468732105bbe231b
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Worked consistently in:

Version: 6.1.0.3
Build ID: efb621ed25068d70781dc026f7e9c5187a4decd1
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk2; 
Locale: en-AU (en_AU.UTF-8); Calc: group threaded

Bibisected with linux-64-6.2 repo to first bad build commit [ae82aa93d4536e9529688f412def4a23908f1d40] which points to core commit 94c1af65367dcbc7272455cf6d4940252a289b62 which is a cherrypick of:

commit 32902f66e7749b2d06d13f50416be5323a0c0ea9
author	Michael Stahl <Michael.Stahl@cib.de>	Fri Nov 30 17:54:41 2018 +0100
committer	Michael Stahl <Michael.Stahl@cib.de>	Tue Dec 18 17:55:30 2018 +0100
sw_redlinehide: make layout based Show/Hide mode the default

Turns out it's related to track changes. Not reproduced if turned off.
Michael, can you please have a look?
Comment 9 Michael Stahl (allotropia) 2024-01-18 16:43:41 UTC
this functionality, which i was previously unaware of, is implemented in:

SwWrtShell::IntelligentCut()

    if(cWord == WORD_NO_SPACE && ' ' == cPrev )
    {
        cWord = WORD_SPACE_BEFORE;
            // delete the space before
        if(bCut)
        {
            Push();
            if(IsCursorPtAtEnd())
                SwapPam();
            ClearMark();
            SetMark();
            SwCursorShell::Left(1,SwCursorSkipMode::Chars);
            SwFEShell::Delete(true);
            Pop(SwCursorShell::PopMode::DeleteCurrent);
        }
    }


... and has existed since initial CVS import.

since this function is obviously more intelligent than i am, i can't know what it ought to do (but perhaps we should tell marketing to mention the AI feature a lot).

fixed the regression on master anyway.
Comment 10 Commit Notification 2024-01-18 16:44:47 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#139631 sw_redlinehide: fix IntelligentCut feature with redlines

It will be available in 24.8.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 11 Commit Notification 2024-01-20 16:41:43 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/53d8675436cb500adff0f9f6aa0063b9c00962dd

tdf#139631 sw_redlinehide: fix IntelligentCut feature with redlines

It will be available in 24.2.1.

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 Stéphane Guillou (stragu) 2024-01-25 06:46:15 UTC
Thanks Michael for the intelligence-mending, fix verified in:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d0dcd87788910e3c9f67a2b68534019c05b77bad
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 13 Commit Notification 2024-07-26 14:22:52 UTC
Kira Tubo committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5f001eb9ceaff1398a65e21ed3fff4aba2450149

tdf#139631: sw unit test: cut preceding space w/ redline

It will be available in 25.2.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.