Bug 154708 - An arrow key repeat deletes characters (macOS with Japanese input source)
Summary: An arrow key repeat deletes characters (macOS with Japanese input source)
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.0.3 release
Hardware: x86-64 (AMD64) macOS (All)
: medium minor
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:7.6.0 target:7.5.3
Keywords: bibisectRequest, regression
Depends on:
Blocks: macOS-UI-polish Shortcuts-Locale
  Show dependency treegraph
 
Reported: 2023-04-08 01:26 UTC by Haruo Toda
Modified: 2024-08-05 05:40 UTC (History)
4 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 Haruo Toda 2023-04-08 01:26:41 UTC
Description:
When I keep pressing shift + one of the arrow keys to select multiple characters, the selected characters are unwillingly deleted. The deleted characters will be no longer resumed by the UNDO function.

If I push-and-release these keys repeatedly, It works well.

In 7.4.x or earlier, this phenomenon does not occur.


Steps to Reproduce:
1.Create or open a Writer document.
2.Enter a character string, like 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
3.Set the cursor at an arbitrary character, e.g. 'L.'
4.Press shift + right arrow (or left arrow) keys for a while to select characters (e.g. 'LMNOPORS' or 'EFGHIJKL').

Actual Results:
The selected (highlighted) characters would be deleted.

Expected Results:
The selected characters stay highlighted.


Reproducible: Sometimes


User Profile Reset: Yes

Additional Info:
Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 8; OS: Mac OS X 10.15.7; UI render: default; VCL: osx
Locale: ja-JP (ja_JP.UTF-8); UI: en-US
Calc: threaded
Comment 1 Telesto 2023-04-08 06:14:58 UTC
I'm unable to reproduce
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1cfeb4bd8ce7f7727a81136bd3e2d6ebea976895
CPU threads: 8; OS: Mac OS X 12.6.3; UI render: Skia/Raster; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 2 Haruo Toda 2023-04-08 15:24:03 UTC
Thank you for testing.

I have found that this phenomenon doesn't occur under English input condition.
Please add '日本語' (Japanese) to your 'Input Source' page of System settings and select '英字' or 'ひらがな' mode by pressing CTRL+space a couple of times.
Comment 3 Haruo Toda 2023-04-10 13:04:39 UTC
I've also noticed that this phenomenon occurs in other LibreOffice components.
For example, 

1. Open a Draw (or Presentation) document and draw a rectangle on it.
2. Select the rectangle by clicking it.
3. Keep pressing one of the arrow keys to move it.
4. The rectangle will disappear.

In the same way to Writer, it works correctly under the English input condition.
By switching the input method to one of the Japanese ones (「ひらがな」「カタカナ」「英字」),
the issue appears again.
Comment 4 Stéphane Guillou (stragu) 2023-04-11 08:39:20 UTC
Thanks for the report.

I can reproduce in:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5da513c1f34f657f910d2a9d1af7761cf649574f
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

Shift + single-clicks on Right arrow work for multi-selection, whereas staying pressed on Right arrow deletes the selection.

Patrick, do you think this might have something to do with d8f358656e1c78c479a417adab12eaee190d3fe7 ?
Comment 5 Stéphane Guillou (stragu) 2023-04-11 08:39:59 UTC
(In reply to Stéphane Guillou (stragu) from comment #4)
> Shift + single-clicks on Right arrow work for multi-selection, whereas
> staying pressed on Right arrow deletes the selection.

Same with all arrows.
Comment 6 Patrick (volunteer) 2023-04-11 13:02:15 UTC
(In reply to Stéphane Guillou (stragu) from comment #4)
> 
> Shift + single-clicks on Right arrow work for multi-selection, whereas
> staying pressed on Right arrow deletes the selection.
> 
> Patrick, do you think this might have something to do with
> d8f358656e1c78c479a417adab12eaee190d3fe7 ?

That commit enabled repeat keys so this bug is very likely due to my commit.

I can reproduce this with the Hiragana keyboard so I will see if I can figure out how these keys are turning into delete events.
Comment 7 Haruo Toda 2023-04-11 14:27:49 UTC
There is another problem supposed to be concerning to the issue.

Open Writer and type 'abcdefghijkl' and set the cursor on 'f', for example.
Then keep pressiing the left or right arrow.

The expected result (and the real result with English input) is the cursor going through the line.
In Japanese input mode, however, the cursor moves only once and nevermore.
Comment 8 Patrick (volunteer) 2023-04-11 14:34:42 UTC
(In reply to Haruo Toda from comment #7)
> There is another problem supposed to be concerning to the issue.
> 
> Open Writer and type 'abcdefghijkl' and set the cursor on 'f', for example.
> Then keep pressiing the left or right arrow.
> 
> The expected result (and the real result with English input) is the cursor
> going through the line.
> In Japanese input mode, however, the cursor moves only once and nevermore.

I can reproduce this as well with the Hiragana input method. I don't have a fix yet, but I put some print statements in the code and when I press-and-hold and arrow key, with or without pressing the Shift key, I see backspace keys being passed to LibreOffice.

So, it appears that both behaviors are caused by the same bug. Now I just need to find where in code these action keys are getting converted to backspace keys.

I will post when I have more information or a fix.
Comment 9 Commit Notification 2023-04-12 00:18:58 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

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

tdf#154708 Preserve selection for repeating Shift-arrow on Japanese keyboard

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 (volunteer) 2023-04-12 11:47:29 UTC
My fix is now in the 2022-04-12 nightly build. With my fix, pressing and holding either Shift-arrow or only arrow while using a Japanese input method should no longer delete characters and should behave normally.

If someone can confirm that my fix works, I will add my fix to the next LibreOffice 7.5 release.
Comment 11 Haruo Toda 2023-04-12 14:30:08 UTC
The 2022-04-12 nightly build works well. I think the bug has been removed now.
Thanks for quick fix!
Comment 12 Stéphane Guillou (stragu) 2023-04-12 15:44:53 UTC
Marking as verified for Haruo.
A cherrypick to 7.5 would be great, Patrick, yes.
Thank you both!
Comment 13 Commit Notification 2023-04-13 11:53:29 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

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

tdf#154708 Preserve selection for repeating Shift-arrow on Japanese keyboard

It will be available in 7.5.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 14 Haruo Toda 2023-04-14 14:38:37 UTC
LibreOfficeDev_7.5.4.0.0_MacOS_x86-64.dmg 2023-Apr-14 01:27 build works fine.
I'm waiting for a patched version of LibreOfficeDev 7.5.3
Comment 15 Remlar 2024-08-05 05:40:58 UTC Comment hidden (spam)