Fairly new user and not sure if this is a bug or not. I tried searching around and saw some stuff that might be close? But I wasn't sure, so I figured I'd post here. I'm currently using Joplin 1.6.8 on macOS (Catalina 10.15.7 if it makes a difference). I was remapping some of my keyboard shortcuts and testing them out when I noticed that many of them don't seem to work if the focus is currently the message note in the markdown editor. For example, the GoTo Anywhere and Command Pallette. If I first switch focus elsewhere, it seems to work. Not sure if that's "working as intended" or "in process" or maybe a setting I needed to enable. Thanks!
Have you tried restarting Joplin? This sounds like a bug, and i think restarting might help. I'm not sure though.
I did. Even rebooted. I was playing around with it a bit more and noticed a couple things. The default shortcut for command pallet works fine, but I run into issues when I re-map it to ctrl+shift+p. Also, I remapped my GoTo Anywhere to ctrl+p, which has the same issue. And if my focus is in the note title, it looks like it's treating my ctrl+p the same as "Home" (and ctrl+shift+p the same as shift+home).
Could you find a remapping that consistently doesn't work? I'm not able to duplicate this issue on my end (Linux, v1.6.8). I suspect this is a bug with the macOS keybindings, but I can't figure out what it could be.
I've remapped Goto Anything
and Command Palette
on my macOS, and this works splendidly.
{
"command": "gotoAnything",
"accelerator": "Cmd+G"
},
{
"command": "commandPalette",
"accelerator": "Shift+Cmd+G"
},
I just tried the same thing on my macOS and it works without problems.
Weird. I just tried mapping it to some other shortcuts and those work, for instance "Ctrl+Shift+Q" works perfectly fine, but "Ctrl+Shift+P" does not. What version of macOS are you on? I'm trying to think of something on my system that would be changing that, but can't think of anything. I can use those shortcuts just fine in other programs.
I'm on 10.14.6 (18G7016), but I also have Catalina, which I can use for another test tomorrow.
Some apps or macOS services use their own shortcuts. macOS global shortcuts usually have priority.
Did you happen to get a check on Catalina? This morning, I upgraded to the latest 1.7.10, and wiped out my joplin-desktop folder, but I still have the issue. Additional things I've noticed, it's not actually mimicking the home key, but rather the default mac document shortcuts to move up a line and move down a line (both ctrl+p & ctrl-n) have the issue. I'm not sure what else to try at this point (of note, my windows PC works perfectly fine and already defaults to the shortcuts I want).
Yes, I just tried on Catalina and it works there for me as well. Ctrl+P and Ctrl+Shift+P both work in Joplin.
Can you please post the contents of your keymap-desktop.json
file?
Sure. I just started from a fresh keymap and modified only my gotoAnything & commandPalette. And they work fine as long as i'm not in the note body or title (note body, they do nothing, title: they act like the normal macOS move up one line & move up and select one line).
│ File: keymap-desktop.json
--------------------------------------------------------
1 │ [
2 │ {
3 │ "command": "gotoAnything",
4 │ "accelerator": "Ctrl+P"
5 │ },
6 │ {
7 │ "command": "commandPalette",
8 │ "accelerator": "Ctrl+Shift+P"
9 │ }
10 │ ]
Ok, I have to revert my previous comments. Apparently the focus was not in the note body (for both of my tests - Mojave and Catalina). I'm very sorry about that.
Now I could reproduce your problem on 10.14.6 - at least partly. When I'm in the note body and I press Ctrl+P
, nothing happens. The cursor does not even move to the previous line.
@CalebJohn it seems that CodeMirror prioritizes system wide shortuts over shortcuts set by Joplin. Any idea how this can be solved?
I'm guessing this is related to an issue that we had when setting up spellcheck with CodeMirror. @tessus @rsb177 do you have spell check enabled in the options?
If so I think the issue can be fixed by registering the gotoAnything
command with the command service (it is one of a few commands that aren't registered with the command service, the others will also need to be updated). Even if you don't use spell check, this is probably worth trying.
I actually didn't have that enabled. I tried enabling it to see if it behaved any different and it does (a little). Now, in the note body, it behaves the same as it does in the title (move up a line).
Nope. Spellcheck is the first thing I deactivated....
I tried changing another action to use Ctrl+P and it worked fine, so it's definitely just certain actions (gotoAnything & commandPalette). I also can't override those commands from the macOS Keyboard Shortcuts like I can with zooming or toggling comments and things like that.
Want me to open an issue on Github?
Not yet. Let me do what Caleb suggested. I'll look into it tonight.
I'll register these 2 commands with the command service. If it works, I'll create a PR. If not, a gh issue would be the next step.
Awesome, thank you. I'm just happy to know it's not just me.
@CalebJohn I've been looking into the CommandService.ts
file, but there's no method to register that command. And it's clearly not a isEditorCommand
.
Can you pleaae elaborate on your statement? I've also checked other parts of the code, but I couldn't find where to register it.
You'll need to register it with the CommandService.registerDeclaration
and CommandService.registerRuntime
functions.
I'm not actually sure how that can be done for the gotoAnything
command. @laurent will know more.