Skip to content

Cursor position after "Move subtree" doesn't allow for convenient repetition #752

Closed
@seflue

Description

@seflue

Describe the bug

While playing around with Hydra.nvim to create a convenient way to reorder headlines and subtrees, I discovered, that the cursor position after moving the subtree up or down doesn't allow for convenient repetition. If the current tree has no child items, everything works fine, but as soon as it has child items, the behavior of placing the cursor at the last line after the movement (which just happens automatically, if we don't take additional care) ends in "Cannot move past superior level" with the next attempt to move the subtree, even the move would be valid.

I propose to set the cursor to the heading which get's moved around as soon as the command ends.

Steps to reproduce

Example org file:

* Heading
** Subheading1
some content
** Subheading2
** Subheading3
*** Child heading
more content

Try to move Subheading3 up twice.

Expected behavior

Command should be repeatable without any quirk.

Emacs functionality

I don't remember any issues with this in Emacs

Minimal init.lua

Nothing of relevance here.

Screenshots and recordings

No response

OS / Distro

Linux

Neovim version/commit

0.10

Additional context

I wile provide a PR with a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions