Bug 162010 - Pasting in search field not working (MacOS)
Summary: Pasting in search field not working (MacOS)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.2.4.2 release
Hardware: ARM macOS (All)
: medium normal
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:25.2.0 target:24.8.0.2 target:...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-12 04:27 UTC by Alexey
Modified: 2024-07-25 05:36 UTC (History)
2 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 Alexey 2024-07-12 04:27:51 UTC
Description:
Macbook Pro - MacOS Sonoma 14.6
System locale: English USA
LibreOffice Version 24.2.4.2 & 24.2.5.2 (aarc64) 
Kazakh or Russian language.





Steps to Reproduce:
0. Select Russian language
1. Copy the text from any source on the mac
2. Fire up calc
3. Command+F (find) or from the Edit - Find menu.
4. Place the cursor in the search box in the lower right corner
5. Command+V or from the Edit-Paste menu
6. The text is pasted into the last selected cell of the sheet, not the search box!

If English is selected, everything works fine.

Actual Results:
The text is pasted into the last selected cell of the sheet, not the search box!

Expected Results:
The text is pasted into the search box


Reproducible: Always


User Profile Reset: No

Additional Info:
LO build: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
https://git.libreoffice.org/core/+log/bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59

Version: 24.2.5.2 AARCH64
Locale: en-US (en_SE.UTF-8); UI: en-US
UI render: Skia/Raster; VCL: osx
MacOS 14.6
Comment 1 Stéphane Guillou (stragu) 2024-07-12 06:22:49 UTC
Not reproduced in:

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 4; OS: macOS 14.5; UI render: Skia/Raster; VCL: osx
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Can you provide e.g. an example website to copy Russian text from, so everyone tests using the same conditions?
Comment 2 Alexey 2024-07-12 06:31:10 UTC
> Can you provide e.g. an example website to copy Russian text from, so everyone tests using the same conditions?

Switch rus on your keyboard and paste any text with cmd+v into the search box.
Comment 3 QA Administrators 2024-07-13 03:15:10 UTC Comment hidden (noise)
Comment 4 Alexey 2024-07-15 05:23:35 UTC Comment hidden (obsolete)
Comment 5 Patrick (volunteer) 2024-07-22 22:01:01 UTC
I am able to reproduce this bug in my local master build. I am running the default English version of LibreOffice and I copied some English text from a Terminal window. Then, I switch to a Russian keyboard and press Command-f and Command-v, the text gets pasted into the selected cell. But if I switch back to a U.S. or Canadian keyboard and do the same steps, the text is pasted in the search field.

There must be something very subtly different between the key events that Command-v generates depending on the keyboard even though Command-v is mapped to the same physical keys with both keyboards.

Not sure how to debug this though. I will need to read through LibreOffice's event handling code and see if I can find anything different in the key events.
Comment 6 Patrick (volunteer) 2024-07-23 00:50:26 UTC
I figured out what is happening. When using a Russian keyboard, Command-v triggers the Edit > Paste menu item and that menu item always pastes into the selected cell even if the search field has focus.

I can reproduce this bug with a U.S. or Canadian keyboard by clicking in the search field (so that it has focus) and then selecting the Edit > Paste menu item. Apparently, pressing Command-v with U.S. and Canadian keyboards does not select the Edit > Paste menu item and, instead, comes through as a key press event.

Anyway, the cause of the bug is in Calc's code that handles the Edit > Paste menu item. I am not very familiar with the Calc code so I don't know where that code is. But when I have time, I see if I can at least locate that code.
Comment 7 Patrick (volunteer) 2024-07-23 11:47:28 UTC
Looks like this bug is another case of tdf#49853 but the fix for that bug only works with Western European keyboards. So not only do Russian keyboards have this bug, but many other non-Western keyboards such as Japanese - Kana also have this bug.

I really think that the fix for tdf#49853 is inadequate since this bug occurs when in all document types (not just Calc) and with any keyboard layout when the Edit > Paste menu is selected.
Comment 8 Commit Notification 2024-07-23 23:34:04 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/57f46e0244bdc1165ebbc5e09e4069cc075ff7ae

tdf#162010 match based on key equivalent instead of key event

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 9 Patrick (volunteer) 2024-07-23 23:44:41 UTC
I have committed a fix this bug. I fixed it by modifying the fix for tdf#49853. Also, I found that the various keyboard shortcuts failed in the native Open and Save dialogs when using some non-Western keyboard layouts such as Russian and Japanese - Kana so fixed that bug as well by modifying the fix for tdf#126638.

The above two fixes should be in tomorrow's (24 July 2024) nightly master builds:

https://dev-builds.libreoffice.org/daily/master/current.html

Note for macOS testers: the nightly master build installer does not overwrite any LibreOffice official versions. Instead, it will be installed as a separate application called "LibreOfficeDev" in the /Applications folder.

Because this is a "test" build, you will need to do the following steps before you launch the LibreOfficeDev application:

1. Go to the Finder and navigate to the /Applications/Utilities folder
2. Launch the "Terminal" application
3. Paste the following command in the Terminal application window and press the Return key to execute the command:

   xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 10 Commit Notification 2024-07-25 05:35:37 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/291d1e0e2c5a8b6c38cf2d62e5759e5e9c83f175

tdf#162010 match based on key equivalent instead of key event

It will be available in 24.8.0.2.

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-07-25 05:36:40 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#162010 match based on key equivalent instead of key event

It will be available in 24.2.6.

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.