Bug 155453 - Cell content's formatting lost when edited in formula bar
Summary: Cell content's formatting lost when edited in formula bar
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.6.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: GTK3 Cell-Direct-Formatting-Parts 116261
  Show dependency treegraph
 
Reported: 2023-05-23 14:17 UTC by Stéphane Guillou (stragu)
Modified: 2024-03-10 01:54 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
video testing the bug (1.81 MB, video/mp4)
2023-05-29 05:56 UTC, BogdanB
Details
macOS crash log (15.99 KB, text/plain)
2023-08-16 23:50 UTC, Patrick Luby (volunteer)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Guillou (stragu) 2023-05-23 14:17:46 UTC
Steps:
1. Open Calc
2. Enter some text in a cell, e.g.: test test
3. Format part of the string in red
4. Continue editing contents _in cell_: formatting remains
5. Continue editing contents _in formula bar_: formatting lost

Repro in recent master build:

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

No repro with kf5 or gen VCLs.

Bibisected with linux-64-7.2 repo to first bad commit 6369dbd4a2915435b19c43ef4db47139279b71c7 which points to core commit:

commit e388a4d6d7ab355fc7aa5fca05e06070693847e9
author	Caolán McNamara <caolanm@redhat.com>	Tue Mar 01 16:50:37 2022 +0000
committer	Adolfo Jayme Barrientos <fitojb@ubuntu.com>	Wed Mar 02 04:30:47 2022 +0100
Resolves: tdf#145580 need to use gtk_im_context_filter_keypress
for at least xim, ibus works fine. To reproduce under Fedora with gtk3
can use a keyboard layout of "US International with dead keys" with
export GDK_BACKEND=x11
export GTK_IM_MODULE=xim
and 'a in writer comment or calc header/footer dialog
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130802

Caolán, can you please have a look?
Comment 1 Caolán McNamara 2023-05-24 19:38:46 UTC
bug 155350 was from the same commit so presumably something similar in nature wrt receiving text from the Input Method rather than as KeyEvents
Comment 2 Commit Notification 2023-05-28 12:44:08 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1a6d250f34c63808552f783a31a315bc7d80ca93

Resolves: tdf#155453 formatting lost when formula bar edited via IM

It will be available in 7.6.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 3 Caolán McNamara 2023-05-28 12:49:08 UTC
seems to work ok, won't backport immediately but give it some time to see if there are unwanted side effects
Comment 4 BogdanB 2023-05-29 05:56:39 UTC
Created attachment 187568 [details]
video testing the bug

Caolan, it is not loosing formatting when clicked in the formula bar, but soon after typing. See video.

Tested on
Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: b76a3bdc996f275f9d615b32d6ab89d533a7505c
CPU threads: 16; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 5 Caolán McNamara 2023-05-30 14:16:36 UTC
(In reply to BogdanB from comment #4)
> it is not loosing formatting when clicked in the formula bar, but
> soon after typing

Yeah, as soon as Input Method events arrive. This seems to be good in trunk now.
Comment 6 BogdanB 2023-05-30 14:24:14 UTC
(In reply to Caolán McNamara from comment #5)
> (In reply to BogdanB from comment #4)
> > it is not loosing formatting when clicked in the formula bar, but
> > soon after typing
> 
> Yeah, as soon as Input Method events arrive. This seems to be good in trunk
> now.

I was testing this after your patch. This video is after.
Comment 7 BogdanB 2023-05-30 14:31:47 UTC
With yesterday master I repro this bug, exactly as in the video.
Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: fc4f7db59152f606b6aa88cf32197700959d0f8b
CPU threads: 16; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 8 Caolán McNamara 2023-05-30 15:23:55 UTC
hmph, I could have sworn that worked yesterday
Comment 9 Commit Notification 2023-05-30 20:27:35 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

Revert "Resolves: tdf#155453 formatting lost when formula bar edited via IM"

It will be available in 7.6.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 10 Patrick Luby (volunteer) 2023-08-16 23:46:19 UTC
Unfortunately, on macOS I am seeing the following with this patch:

- master branch: no change in behavior in formula bar i.e. bug still occurs
- libreoffice-7-5 branch: crash in formula bar

I am using the Japanese Hiragana input method on macOS so to reproduce, I used the following steps:

1. Create empty Calc document
2. Click on a cell and type (English keyboard keys) "watashinona" i.e. わたしのな
3. Select the last two Japanese characters in the formula bar
4. Press the arrow-right key to commit the text
5. Type any character

I'll attach a crash log for the libreoffice-7-5 branch crash. The crash is occurring when nCommand == CommandEventId::StartExtTextInput.
Comment 11 Patrick Luby (volunteer) 2023-08-16 23:50:16 UTC
Created attachment 189001 [details]
macOS crash log