NotepadNext icon indicating copy to clipboard operation
NotepadNext copied to clipboard

Missing/inconsistent text navigation shortcuts on MacOS

Open mutleybg opened this issue 11 months ago • 10 comments

Description

Hi guys,

I really appreciate this project as a big Notepad++ fan who moved to Mac OS. I have the following issues on MAC:

  • I see no shortcut to go to beginning/end of a file. For MacOS: Cmd + Arrow Up, Arrow Down are the standard shortcuts for all text editors
  • Cmd + Left/Right arrow moves the cursor one word left/right. This is the behavior on Windows, however on Mac these shortcut by default move the cursor to the beginning/end of line. Option + Left/Right arrow move the cursor one word left/right. Could you please change it to correspond to Mac OS: Cmd + Arrow - move the cursor to the beginning/end of the line. Option + Arrow - move the cursor one word left/right.

Best regards

Describe the solution you'd like

On Mac OS: Cmd + Arrow Up/Down -> Move the cursor to the beginning/end of a file. Cmd + Arrow Left/Right -> Move the cursor to the beginning/end of a line. Option + Arrow Left/Right -> Move the cursor one word left/right.

Describe alternatives you've considered

No response

mutleybg avatar Feb 11 '25 10:02 mutleybg

There were some possibly similar issues reported in #516 about shortcuts not getting mapped correctly on MacOS but not specifically the ones you mentioned.

Cmd + Arrow Up/Down -> Move the cursor to the beginning/end of a file. Cmd + Arrow Left/Right -> Move the cursor to the beginning/end of a line.

There looks to be a flag in the Scintilla library that I might be able to set to enable these here:

https://github.com/dail8859/NotepadNext/blob/48b11b3d39e5f48e6ec5fbd33745adbb04fbf3a0/src/scintilla/src/KeyMap.cxx#L80-L89

Option + Arrow Left/Right -> Move the cursor one word left/right.

It's a bit hard to follow if these keys are configured in that file. I can try to at least turn on that OS_X_KEYS flag and have you test it. Ultimately someone with a Mac would be best to do a trial and error on all these since I'm not familiar with the mac specific key combos.

dail8859 avatar Feb 11 '25 17:02 dail8859

If you could, try this new dmg (might need to unzip it first) and see if they keyboard shortcuts behave more like you'd expected:

https://github.com/dail8859/NotepadNext/actions/runs/13330403764/artifacts/2592759409

dail8859 avatar Feb 14 '25 14:02 dail8859

Could someone on MacOS test this?

dail8859 avatar Mar 27 '25 15:03 dail8859

Could someone on MacOS test this?

Hi. Not OP, but I tried this out on a macbook pro running 15.1.1 (24B91). It does not work as I expect as a macOS user. Command + up/down scroll the file; command + left/right do not move to the beginning/end of line, etc.

Deadpikle avatar Apr 03 '25 01:04 Deadpikle

@Deadpikle That's unfortunate to hear but good to know at least. I don't have a macOS to build/test with so hopefully someone else can take a shot at fixing it.

dail8859 avatar Apr 03 '25 01:04 dail8859

@dail8859 Do you have a discord or Element chat or similar I could chat with you on? I've got the project running locally, and I see the issue with the PR you had before (wrong define possible). I'm not a Qt User, so I'm unfamiliar with how it works, and if you were able to give me a few pointers, we might be able to figure this one out.

More details: if I force OS_X_KEYS to be 1 by editing the scintilla source file, it does what one would expect. This is controlled by PLAT_GTK_MACOSX; if I set DEFINES += PLAT_GTK_MACOSX=1, this doesn't seem to take effect, either, due to Platform.h defining this separately. Seems like an order of operations issue or something...based on Platform.h, SCINTILLA_QT being defined makes the detection for macOS stuff not run, as that relies on SCINTILLA_QT and SCINTILLA_QT_QML not being defined already...(the Platform.h defines are kinda messy here, IMO)

Is there some way to just rebuild the scintilla lib and not the whole project after changing the .pri file?

Basically, I think the defines in Platform.h need to be overwritten somehow, but I'm not sure if the .pri file is parsed first or after Platform.h, which would effect which defines are being used.

See:

https://github.com/dail8859/NotepadNext/blob/5875f739855ea0c80dba7a1f10ec8ab248587697/src/scintilla/src/Platform.h#L18-L76

https://github.com/dail8859/NotepadNext/blob/5875f739855ea0c80dba7a1f10ec8ab248587697/src/scintilla/src/KeyMap.cxx#L55-L59

Maybe that's enough info to help you figure it out.

Deadpikle avatar Apr 03 '25 03:04 Deadpikle

For the record, if you can edit Keymap.cxx directly, changing the #if PLAT_GTK_MACOSX to #if defined(__APPLE__) also fixes it. Since the PLAT_GTX_MACOSX is kinda hard to get triggering since a change in .pri seems to be undone in Platform.h...but this may have other repercussions.

I'm not familiar enough with the project to really know how to do a good job digging further, but if you have any pointers, I'm happy to try them out if they're quick.

I'm wondering if there is another way to build the project (via CI/CD or otherwise) that would trigger the correct flow in Platform.h or similar. 😬

EDIT: See also — https://sourceforge.net/p/scintilla/bugs/1596/

Deadpikle avatar Apr 03 '25 03:04 Deadpikle

@Deadpikle Appreciate you looking into this!

but this may have other repercussions

Agreed. Since that is part of Scintilla I cannot say for sure what else might be affected. Ideally Scintilla would fix it upstream so that it could be properly enabled.

dail8859 avatar Apr 03 '25 12:04 dail8859

Please fix the overriding of alt/option and the arrow keys/backspace/etc. That should never be touched - it's a macOS system keyboard navigational function and crucial for managing text quickly.

yllekz avatar Oct 04 '25 12:10 yllekz

I don't have a Mac so someone would need to submit a pull request, or if it is Scintilla related it would need fixed in that project.

dail8859 avatar Oct 04 '25 12:10 dail8859