vipzhicheng / logseq-plugin-vim-shortcuts

Add part of VIM key bindings experience to Logseq
MIT License
334 stars 17 forks source link

Go to next/previous sibling not working #56

Open maubuz opened 4 months ago

maubuz commented 4 months ago

Go to next and previous sibling (shift + j / shift + k) is no longer working in logseq 0.10.6 via snap on Ubuntu 23.10, vim-shortcuts v0.1.22.

I've recently migrated my system from Fedora to Ubuntu and just noticed these shortcuts no longer work. Other shortcuts seem to work fine. I loaded logseq with the Dev Tools console and I see messages about the shortcuts being registered. For example:

:shortcut/register-shortcut [:shortcut.handler/global-non-editing-only :plugin.logseq-vim-shortcuts/vim-shortcut-next-sibling-0 {:fn #object[Function], :desc nil, :key vim-shortcut-next-sibling-0, :type $palette$, :binding (shift+j), :label Go to next sibling, :cmd {:id :plugin.logseq-vim-shortcuts/vim-shortcut-next-sibling-0, :desc Go to next sibling, :shortcut shift+j, :handler-id :shortcut.handler/global-non-editing-only, :action #object[Function]}, :keybinding {:mode non-editing, :binding shift+j}, :extras nil}]

However, when I try to use the shortcut (eg. shift + j), I get the following error:

index.e8f2ed0c.js:1018 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'uuid')
    at g6 (index.e8f2ed0c.js:1018:19313)
    at async qr.<anonymous> (index.e8f2ed0c.js:1018:19793)

I'm happy to help debug. I noticed that @Weiming-Hu recently commented on #41 about this issue. Maybe related? Thank you so much for this amazing extension!

Weiming-Hu commented 4 months ago

Thanks for reporting. Can you show me where to find the error message? I want to confirm whether we had the same errors.

maubuz commented 4 months ago

I first activated Developer Mode in logseq settings and then opened the Developer Tools with ctrl + shit +i. Once in Developer Tools, I opened the Console tab to see if anything was being logged by the plugin. I also disabled all other plugins to avoid extra logs. This process is well described in this logseq forum discussion and in the Chrome Dev Tools documentation. Hope this helps.

Weiming-Hu commented 4 months ago

Thank you for the instructions. I was able to capture the error message. It looks like we are hitting the same error. Details below.

index.e8f2ed0c.js:1018 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'uuid')
    at F6 (index.e8f2ed0c.js:1018:22219)
    at async qr.<anonymous> (index.e8f2ed0c.js:1018:22674)
maubuz commented 4 months ago

It looks like this issue was introduced in version 0.1.21 of this plugin with commit 707eca6. I was able to install version 0.1.20 of the plugin and shift+j and shift+k work as expected.

To install previous versions of this plugin I used the logseq feature Install plugins from plugins.edn, which is described in the docs. Content of my .logseq/config/plugins.edn file:

{
:logseq-plugin-vim-shortcuts {:version "v0.1.20", :repo "vipzhicheng/logseq-plugin-vim-shortcuts", :effect true, :theme false}
}
Weiming-Hu commented 4 months ago

Confirm that 0.1.20 works for me. But always happy to test further if needed.

ches commented 4 months ago

It seems for me that next/previous sibling is working on v0.1.22, but it works when viewing individual pages only—it does not work on the home journal view.

Also the Highlight focus in/out actions (l/h bindings by default) have the same behavior, not working on home journal but working elsewhere.

Can others reproduce that? In my case I think I first believed features weren't working at all, until I realized there's some context specificity to it.

While we're getting into a breakdown of these functions working on various UI states… I also find that Highlight focus in/out does not work when I zoom into a block. Sibling navigation does work when zoomed, since #41—perhaps a fix is similar as for that one. That's worth filing as a specific issue, maybe.

Weiming-Hu commented 4 months ago

Confirmed that next/previous sibling is working in zoomed (focused) view and in pages but not in journal.

Vim shortcuts version: v0.1.22 logseq version: 0.10.7