Bug 157130 - Characters don't appear when pressing with CMD+Z pressed for couple of seconds and track changes record enabled (macOS-only)
Summary: Characters don't appear when pressing with CMD+Z pressed for couple of second...
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0 target:24.8.4
Keywords: bibisected, regression
Depends on:
Blocks: Writer-View-Jumps
  Show dependency treegraph
 
Reported: 2023-09-07 07:57 UTC by Telesto
Modified: 2024-11-28 21:02 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
quickly taken screenshot of my MBP2014 (695.59 KB, image/png)
2024-10-30 15:25 UTC, Dennis Roczek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2023-09-07 07:57:17 UTC
Description:
Characters don't appear when pressing with CMD+Z pressed for couple of seconds and track changes record enabled

Steps to Reproduce:
1. Open attachment 177175 [details] (bug 146452)
2. Punt the cursor at the end of the paragraph 
3. Press and hold backspace for say 20 seconds
4. Press and hold CMD+Z

Actual Results:
Cursor moves, but glyphs don't appear (paint)

Expected Results:
On each undo a character shows


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e60ef8651cfb30335471d1622e58c13eebc7d58b
CPU threads: 8; OS: Mac OS X 13.4.1; UI render: default; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 1 Telesto 2023-09-07 21:23:32 UTC
Fine on Windows with
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c9916d9be9c060d43fc063b76d70629162650fea
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded
Comment 2 Buovjaga 2023-09-26 06:05:56 UTC
Seems specific to macOS as I can't repro on Linux with any UI

Arch Linux 64-bit, X11
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5e9c8d21874eea8cb5adf2ecab1905295af2308f
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 26 September 2023
Comment 3 Stéphane Guillou (stragu) 2023-09-28 12:21:44 UTC
Reproduced in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d88779fc86385dde1215fd28b78a69eacc6b4f97
CPU threads: 2; OS: Mac OS X 13.2.1; UI render: Skia/Raster; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

View does not refresh until keys released.

Not reproduced in:

Version: 7.4.6.2 / LibreOffice Community
Build ID: 5b1f5509c2decdade7fda905e3e1429a67acd63d
CPU threads: 2; OS: Mac OS X 13.2.1; UI render: default; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

...in which the view is refreshed word-by-word.
Comment 4 Patrick (volunteer) 2023-09-29 21:04:17 UTC
In my local master build, I can reproduce this bug with Skia/Metal, Skia/Raster, and Skia disabled. But in all 3 cases, when I do steps 3 and 4 in https://bugs.documentfoundation.org/show_bug.cgi?id=157130#c0 a second time, I cannot reproduce the bug.

So I don't think this is a Skia flushing bug. Maybe Writer is doing some post-document loading work that is blocking repainting?

Version: 24.2.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 77243143dfe8c462a3e4e74a1f5a8a1e58046635
CPU threads: 8; OS: macOS 14.0; UI render: Skia/Metal; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded
Comment 5 Dennis Roczek 2024-07-28 20:56:34 UTC Comment hidden (obsolete)
Comment 6 Stéphane Guillou (stragu) 2024-07-29 01:59:04 UTC Comment hidden (obsolete)
Comment 7 Dennis Roczek 2024-10-11 10:28:30 UTC
(In reply to Patrick (volunteer) from comment #4)
> But in all 3 cases, when I do steps 3 and 4
> in https://bugs.documentfoundation.org/show_bug.cgi?id=157130#c0 a second
> time, I cannot reproduce the bug.

Yeah, I'm trying to do some bibisecting it again, but having the problem that it sometimes works - although I do know that "MASTER" is not correctly working in this 

Interestingly there were some changes: when bibisecting I had to skip source commits 7a7a831809fdcf8a25b907ab7f576cb5210d7b47
and 03e4114097f21f82c7a6a8a64dd08684f09a99b8
because revert was not working at all in these bot builds by keep cmd+z holding.

I still try to find some way to bibisecting this again...
Comment 8 Noel Grandin 2024-10-14 15:42:32 UTC
does this help: https://gerrit.libreoffice.org/c/core/+/174905 ?
Comment 9 Dennis Roczek 2024-10-14 16:10:23 UTC
(In reply to Noel Grandin from comment #8)
> does this help: https://gerrit.libreoffice.org/c/core/+/174905 ?

to clarify: I have "manually" bibisect the bug at the conference back to commit 16429ec437f4bf2acf33b4b2d968b45548f779b4 (with many reboots!) and asked Noel if it is possible, that this bug could cause this behavior. I'm still not sure if this is really the bad commit.

I'm unable to build on/for mac. @Patrick as you were able to reproduce this glitch at least once, could you test it?
Comment 10 Patrick (volunteer) 2024-10-15 13:30:29 UTC
(In reply to Dennis Roczek from comment #9)
> I'm unable to build on/for mac. @Patrick as you were able to reproduce this
> glitch at least once, could you test it?

I retested this bug on macOS in my local master build with Noel's patch and I cannot reproduce this bug:

Version: 25.2.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 633fad32611e39620218319327428050405a6b1a
CPU threads: 8; OS: macOS 15.0.1; UI render: Skia/Metal; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded

But...what I do see is that if I follow the steps in comment #0 and I press and hold the Delete key until "Who" is deleted, undoing will stop working (and the Edit > Undo menu item will be disabled) after only half the deleted text is undone if I press and hold Command-Z.

Maybe that is normal and I the large number of deletes exceeds some internal "maximum undo steps" limit?
Comment 11 Buovjaga 2024-10-15 13:39:34 UTC
(In reply to Patrick (volunteer) from comment #10)
> But...what I do see is that if I follow the steps in comment #0 and I press
> and hold the Delete key until "Who" is deleted, undoing will stop working
> (and the Edit > Undo menu item will be disabled) after only half the deleted
> text is undone if I press and hold Command-Z.
> 
> Maybe that is normal and I the large number of deletes exceeds some internal
> "maximum undo steps" limit?

LibreOffice - Preferences - LibreOffice - Advanced - Open expert configuration: search for undo and scroll until you see preference name Undo, property Steps. There you can change the value.
Comment 12 Patrick (volunteer) 2024-10-15 16:40:09 UTC
(In reply to Buovjaga from comment #11)
> LibreOffice - Preferences - LibreOffice - Advanced - Open expert
> configuration: search for undo and scroll until you see preference name
> Undo, property Steps. There you can change the value.

Thanks for the steps. I increased the undo steps from 100 to 1000 in my local master build and I cannot reproduce this bug. All deleted characters are reinserted immediately with no lag in drawing if I press and hold Command-Z.

I also increased the undo steps in my LibreOffice 24.2.5.2 and 24.8.2.1 installations and I cannot reproduce this bug with either version so maybe we can marked this as resolved?
Comment 13 Dennis Roczek 2024-10-22 16:20:43 UTC
(In reply to Patrick (volunteer) from comment #12)
> I also increased the undo steps in my LibreOffice 24.2.5.2 and 24.8.2.1
> installations and I cannot reproduce this bug with either version so maybe
> we can marked this as resolved?

You mean changing the option without using Noel's commit?
(if so, I want to reproduce this nasty bug)
Comment 14 Patrick (volunteer) 2024-10-22 16:54:43 UTC
(In reply to Dennis Roczek from comment #13)
> You mean changing the option without using Noel's commit?
> (if so, I want to reproduce this nasty bug)

Correct. I tested with the official LibreOffice 24.2.5.2 and 24.8.2.1 releases (i.e without Noel's patch) and the only non-default preference change I made was to increase the maximum undo steps from 100 to 1000.

I only tested my local master build with Noel's patch.
Comment 15 Commit Notification 2024-10-24 08:54:41 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/148fa9e9405b143f9fc228d9b5f967cad3139967

tdf#157130 undo and track changes not restoring characters (macOS)

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.
Comment 16 Dennis Roczek 2024-10-29 17:27:36 UTC
With 
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f6c9d1012d20541f6373b51ff3c25d8fd7bc8c69
CPU threads: 4; OS: macOS 11.7.10; UI render: Skia/Raster; VCL: osx
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded
I can still reproduce the glitch.

(In reply to Patrick (volunteer) from comment #12)
> (In reply to Buovjaga from comment #11)
> > LibreOffice - Preferences - LibreOffice - Advanced - Open expert
> > configuration: search for undo and scroll until you see preference name
> > Undo, property Steps. There you can change the value.
> 
> Thanks for the steps. I increased the undo steps from 100 to 1000 in my
> local master build and I cannot reproduce this bug. All deleted characters
> are reinserted immediately with no lag in drawing if I press and hold
> Command-Z.
Also didn't change the behavior for me.


Any idea what I can do? I do see in the status bar, that the counter of characters/words is increasing while holding, but the redraw "on the paper" is missing.
Comment 17 Patrick (volunteer) 2024-10-29 20:50:53 UTC
(In reply to Dennis Roczek from comment #16)
> Any idea what I can do? I do see in the status bar, that the counter of
> characters/words is increasing while holding, but the redraw "on the paper"
> is missing.

I retested in my local master build and I still cannot reproduce the bug:

Version: 25.2.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 6668f6e34860b7f42a1ee06a062496a0cb63ce8e
CPU threads: 8; OS: macOS 15.1; UI render: Skia/Raster; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded

I had switched to Skia/Raster to match your Help > About output so the only differences that I see is that you are using macOS Big Sur on Intel and I am using macOS Sequoia on Silicon Mac.

Have you tried restarting LibreOffice using the Help > Restart in Safe Mode? Do you see any change?
Comment 18 Dennis Roczek 2024-10-30 14:40:42 UTC
(In reply to Patrick (volunteer) from comment #17)
> Have you tried restarting LibreOffice using the Help > Restart in Safe Mode?
> Do you see any change?
Yes, and did it again, but no change at all.

I'm also able to reproduce this bug with different machines:

MBA 13" 2019 Retina Intel:
Version: 24.8.2.1 (X86_64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 4; OS: macOS 14.7; UI render: Skia/Raster; VCL: osx
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

MBP 13" Mid2014 Intel (all repros above)

MBP 13" Mid2018 Intel i7
Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 8; OS: macOS 15.1; UI render: Skia/Raster; VCL: osx
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

I can also test following devices:
* MBP M1
* MB 2015 (?)
* MB 2016 (?)
but these devices are in use at this moment.

So long story short: either this is an Intel-based bug or something else is fishy. The profile reset does not help, doesn't depend on macos version, nor UI locale.

(In reply to Dennis Roczek from comment #16)
> I do see in the status bar, that the counter of
> characters/words is increasing while holding, but the redraw "on the paper"
> is missing.

BTW: interestingly, the Status Bar is not updated immediately when removing characters. (is this a bug or a feature ^^)
Comment 19 Dennis Roczek 2024-10-30 15:21:15 UTC
(In reply to Dennis Roczek from comment #18)
> I can also test following devices:
> * MBP M1
> * MB 2015 (?)
> * MB 2016 (?)

Version: 24.8.2.1 (AARCH64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 10; OS: macOS 14.7.1; UI render: Skia/Metal; VCL: osx
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

MBP 14" 2021 M1

Also repro.
Comment 20 Dennis Roczek 2024-10-30 15:25:33 UTC
Created attachment 197306 [details]
quickly taken screenshot of my MBP2014

Just to be sure everybody is talking about the same glitch: using the keyboard shortcut for taking a screenshot of the full screen, I do see the attached cursor in the middle of the paper. Shortly after, the text appears. On all mentioned systems with and without resetting the profile folder. (and independent of the gerrit patch through this is only tested on the mbp2014)
Comment 21 Patrick (volunteer) 2024-10-30 21:21:04 UTC
(In reply to Dennis Roczek from comment #20)
> Just to be sure everybody is talking about the same glitch: using the
> keyboard shortcut for taking a screenshot of the full screen, I do see the
> attached cursor in the middle of the paper. Shortly after, the text appears.
> On all mentioned systems with and without resetting the profile folder. (and
> independent of the gerrit patch through this is only tested on the mbp2014)

So from your Help > About output in comment #19, you were able to reproduce this bug on the same hardware as me (i.e. a 14" M1 MacBook Pro):

Version: 24.8.2.1 (AARCH64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 8; OS: macOS 15.1; UI render: Skia/Metal; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded

The problem is that I still cannot reproduce this bug on my machine. I even rebooted into macOS Sonoma on my machine but still could not reproduce this bug.

I wonder what is different between our Silicon Mac machines? I am not familiar with the Writer code but IIRC Writer usually does not draw immediately after a key event but instead waits to do all drawing to the window in a painting timer.

In your screen snapshot, the cursor and status bar have been redrawn so my first guess is that one or more of Writer's painting timers are never getting a chance to run and they are continually deferred because LibreOffice is not finished processing a key event before another one is in the queue. Only when you stop adding new key events to the queue and LibreOffice has no new input to process does the painting timer finally get a chance to run and draw the undone text.

We have more or less the same CPU so I wonder if LibreOffice is competing with some other application or background process for CPU and that might be slowing down processing of the Command-Z events enough to delay Writer's painting timers. Another possible thing to look at is if you have any applications using the macOS accessibility subsystem to listen for changes in LibreOffice.

Not sure if the above helps. If any Writer developers are reading this bug, I would be interested to hear if they have any ideas.
Comment 22 Patrick (volunteer) 2024-11-11 13:23:24 UTC
I committed a fix for tdf#163764 and that bug had some similarities to this bug.

I still cannot reproduce this bug but I am curious if the fix for tdf#163764 has any effect on this bug.

You can test the fix for tdf#163764 by installing today's nightly master build:

https://bugs.documentfoundation.org/show_bug.cgi?id=163764#c11
Comment 23 Dennis Roczek 2024-11-13 10:54:17 UTC
(In reply to Patrick (volunteer) from comment #22)
> I committed a fix for tdf#163764 and that bug had some similarities to this
> bug.
> 
> I still cannot reproduce this bug but I am curious if the fix for tdf#163764
> has any effect on this bug.
> 
> You can test the fix for tdf#163764 by installing today's nightly master
> build:
> 
> https://bugs.documentfoundation.org/show_bug.cgi?id=163764#c11

still repro using :-(
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 65caa58206bb64c6fa6e482dbd847af1b3c2c1b0
CPU threads: 8; OS: macOS 15.1; UI render: Skia/Raster; VCL: osx
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

(so daily daily/master/MacOSX-x86_64@tb94-TDF/2024-11-12_17.31.41/)
Comment 24 Commit Notification 2024-11-28 21:02:43 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/9471401da95e7b31785dfbe24597da5484e8c35d

tdf#157130 undo and track changes not restoring characters (macOS)

It will be available in 24.8.4.

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.