Avoid having "press up" at the top of the editor go to edit the title of the note

Bug report

Environment

  • Platform:
  • Platform version:
  • App Version:

How to reproduce

  • Put the cursor at the top of a note editor
  • Press the “up” button on your keyboard
  • The cursor is now in the title of the note, rather than the editor it was in before
  • Pressing down doesn’t bring it back into the editor

This gets me all the time, so I thought I would share my experience here. Maybe we can have an optional setting to disable the “press up to go to title” feature?

Hi Michael,

Thanks for the feedback.
Let’s change the behavior where it move the focus to the title when:

-        if (cur.line === 0) {
+        if (cur.line === 0 && cur.ch === 0) {
            // then, move the focus to title

additionally, I found a bug where the cursor doesn’t properly move from the middle of the title to its end when pressing the down arrow key. I’ll fix it.
What’s your platform?

Hi @craftzdog,

Thanks for the quick reply. Personally, I would like to avoid putting the cursor in the title at all using the up arrow key. Is this possible? Or to have this configurable? It would be nice to be able to type Shift+Tab to get to the title when at the very top line of the editor, but not the up arrow imo.

Inkdrop: 5.6.2
OS: Mac M1
OS version: 12.6.8

You can create a custom command that replaces the default editor:go-line-up in your init.js like so:

inkdrop.commands.add(
  document.body,
  'custom:go-line-up',
  (event) => {
    const { cm } = inkdrop.getActiveEditor()

    if (cm) {
      cm.execCommand('goLineUp')
    }

    event.stopPropagation()
  }
})

Check out the doc page for more details on writing init.js here:

Then, bind your command with the up arrow key in your keymap.json:

{
  ".CodeMirror textarea": {
    "up": "custom:go-line-up"
  }
}

docs:

1 Like

@craftzdog Upon thinking about this some more, I’m thinking this should be treated as a bug. When you navigate to the title with the up arrow, should there not be a way to go back to the editor?

Based on your response, there may be a misunderstanding of the issue. The title of this issue actually misrepresents the actual issue occurring. I think going up to the title is acceptable, though there’s no quick way to get back to the editor AFAIK. Maybe there’s an existing keyboard shortcut to get back to the editor from the title? At the moment, you need to press tab 15 times to get back to the editor (when not in distraction-free mode). I would think pressing down would take me back to the editor, since pressing up goes from the editor to the title.

You can press the down key to go back to the editor.
If the cursor is in the middle of the title, the first key down brings the cursor to the end of the title. The second moves the focus to the editor. This behavior is mentioned here:

It is fixed in v5.8.0-beta.1.

the first key down brings the cursor to the end of the title. The second moves the focus to the editor

This is not the case for me though. Pressing down a second time results in nothing happening. I’m using Inkdrop 5.6.2. MacOS Monterey 12.6.8

Can you try v5.8.0-beta.2?