Bug 156705 - macOS keybindings for Home/End malfunctioning
Summary: macOS keybindings for Home/End malfunctioning
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.5.2 release
Hardware: x86-64 (AMD64) macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Shortcuts-Mac
  Show dependency treegraph
 
Reported: 2023-08-09 22:51 UTC by Mike McGranahan
Modified: 2023-11-04 17:01 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Tools > Customize > Keyboard (58.67 KB, image/png)
2023-10-30 23:49 UTC, steve
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike McGranahan 2023-08-09 22:51:04 UTC
Description:
Using macOS 13.5, Home and End do not respect keyboard customizations. On a clean install, going into menu bar Tools > Customize > Keyboard tab, then selecting ↖︎ (Home key) from Shortcut Keys grid, shows To Line Begin as the mapped function.

Therefore, it is expected that when the cursor is located in the middle of a multi-line document, pressing Home moves the cursor to the beginning of that line.

However what actually happens is the cursor moves to the beginning of the document - regardless of the mapped function. This is holds when manipulating mappings with the LibreOffice radio button selected and when the Writer radio is selected.

This is extremely frustrating as it does not follow any text editor conventions on any OS. OpenOffice 4.1.14 also exhibits this buggy behavior. The behavior works as expected on Windows 11 Insider Dev with LibreOffice 7.5.5.2.

See discussion on Ask LibreOffice: https://ask.libreoffice.org/t/map-home-and-end-keys-to-beginning-end-of-line-on-macos/51969

Note 1: on most modern Apple hardware, Home is entered with a Fn+Left key chord.

Note 2: the behavior works as expected on Windows.

Steps to Reproduce:
1. Open a new document.
2. Enter two lines of text.
3. Position cursor at the end of the second line.
4. Press Home.

Actual Results:
Cursor moves to beginning of first line.

Expected Results:
Cursor moves to beginning of second line.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: ca8fe7424262805f223b9a2334bc7181abbcbf5e
CPU threads: 12; OS: Mac OS X 13.5; UI render: default; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Alex Thurgood 2023-10-30 13:38:34 UTC
@Mike:

I don't see any Home key on any of my macOS hardware, be it a Macbook or the magic keyboard, or the standard Mac wireless keyboard. 

Version: 24.2.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 31fb3045dabdb27d913712f3abcade315e3ea9bd
CPU threads: 8; OS: macOS 14.0; UI render: Skia/Raster; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded

In a Writer document, without any personalisation of the keyboard shortcuts:

- pressing Fn-Command-Left arrow takes me to the beginning of the document;
- pressing Fn-Command-Right arrow takes me to the end of the document;
- pointing the cursor to the middle of a line of text, and pressing Cmd-Left takes me to be beginning of the line;
- pressing Cmd-Right takes me to be end of the line.

What am I doing wrong here ?
 
The OS provides for the desired behaviour without having to configure a specific key combination in LibreOffice.
Comment 2 Mike McGranahan 2023-10-30 22:29:10 UTC
Hi Alex,

Thanks for following up. For as long as I can remember (iBook G4 days) Fn-Left and Fn-Right chords correspond to Home and End, per "Note 1" in my original description, and printed on the iBook keyboard as seen in the images here: https://www.cultofmac.com/439728/apple-history-last-ibook-g4/ . It's also mentioned in this Apple support article: https://support.apple.com/guide/mac-help/windows-keys-on-a-mac-keyboard-cpmh0152/mac . Additionally, it is also apparent in the on-screen Accessibility Keyboard, where pressing Fn changes the glyphs on the on-screen left and right keys to ↖︎ and ↘ respectively, which are the same ones that appear in the LibreOffice keyboard customization dialog for Home and End.

I'm not trying to dispute the built-in macOS behavior of Fn-Left and Fn-Right, which is to move the cursor to the beginning and end of a document. What is unexpected is that in LibreOffice, when explicitly mapping ↖︎ to "To Line Begin", the cursor does not actually move to the beginning of the line, but instead moves to the beginning of the document - as if the mapping had not been created. In fact, no matter what I map that key to, the effect is always to move the cursor to the beginning of the document. Remapping ↘, ⌘↖︎, and ⌘↘ also have no effect.

A workaround is described here https://soodev.wordpress.com/2011/07/04/mac-os-x-remapping-home-and-end-keys/ .
Comment 3 steve 2023-10-30 23:49:13 UTC
After scratching my head while looking at your report earlier today, I might now understand better what the issue is. Writer > Tools > Customize > Keyboard has a tooltip saying "To quickly find a shortcut in this list, simply press the key combination."

So I press fn + left arrow and I land on the entry highlighted in screenshot "Tools > Customize > Keyboard". That shortcut is called "To Line Begin" which feels very denglish but also is not Home aka beginning of document.

However when in a multi-line paragraph and pressing "fn + left arrow" LibreOffice goes to beginning of document (and not the beginning of the line as describe in the shortcut list).

While I would consider this expected behavior, there is certainly a mismatch with how rhw option is described in "Tools > Customize > Keyboard".

Thus I confirm this bug and set to new.

Would you agree that the icon is incorrectly named and that should be changed?
Comment 4 steve 2023-10-30 23:49:27 UTC
Created attachment 190520 [details]
Tools > Customize > Keyboard
Comment 5 steve 2023-10-30 23:51:20 UTC
Oh an the same applies to fn + right arrow which goes to end of document while the shortcut describtion says "To End of Line".
Comment 6 Alex Thurgood 2023-10-31 16:44:18 UTC
(In reply to Mike McGranahan from comment #2)
> Hi Alex,
> 
> 
> I'm not trying to dispute the built-in macOS behavior of Fn-Left and
> Fn-Right, which is to move the cursor to the beginning and end of a
> document. What is unexpected is that in LibreOffice, when explicitly mapping
> ↖︎ to "To Line Begin", the cursor does not actually move to the beginning of
> the line, but instead moves to the beginning of the document - as if the
> mapping had not been created. In fact, no matter what I map that key to, the
> effect is always to move the cursor to the beginning of the document.
> Remapping ↘, ⌘↖︎, and ⌘↘ also have no effect.
> 


Thanks Mike, I see that Steve has confirmed this in the meanwhile. Unfortunately, another one to add to the list of incorrectly functioning shortcut configurations on macOS.
Comment 7 bintoro 2023-11-04 11:21:00 UTC
(In reply to Mike McGranahan from comment #0)
> This is extremely frustrating as it does not follow any text editor
> conventions on any OS.

This is not true. Most native Mac apps obey the system-wide keybindings.

(Btw, I highly recommend customizing the bindings to your liking. For a comprehensive list of available actions, see https://gist.github.com/zsimic/1367779.)

But yeah, it’s true that the customizations defined in LO should take precedence, which doesn’t seem to be happening currently.


(In reply to steve from comment #3)
> Would you agree that the icon is incorrectly named and that should be
> changed?

I don’t think that the name of the command is the issue here. The issue is that the command is not triggered. Instead, LO performs the system-wide action assigned to the key combination.
Comment 8 Mike McGranahan 2023-11-04 17:01:39 UTC
(In reply to kalle from comment #7) 
> This is not true. Most native Mac apps obey the system-wide keybindings.

I stand corrected!

> (Btw, I highly recommend customizing the bindings to your liking. For a
> comprehensive list of available actions, see
> https://gist.github.com/zsimic/1367779.)

Very helpful, thank you.

> (In reply to steve from comment #3)
> > Would you agree that the icon is incorrectly named and that should be
> > changed?
> 
> I don’t think that the name of the command is the issue here. The issue is
> that the command is not triggered. Instead, LO performs the system-wide
> action assigned to the key combination.

I agree with Kalle here.