Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
seflue opened this issue Jun 10, 2024 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@seflue
Copy link
Contributor

seflue commented Jun 10, 2024

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.

@seflue seflue added the bug Something isn't working label Jun 10, 2024
@seflue
Copy link
Contributor Author

seflue commented Jun 10, 2024

PR #753 fixes this bug.

SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this issue Aug 16, 2024
* tests: improve test cases for subtree move

- repeated move
- evaluate cursor position after move

* fix: cursor position after moving subtree

To allow for repetition of moving a subtree, the cursor must stay on the
headline.

* fix: preserve folding when moving subtree

To be consistent with promotion and demotion commands, we preserve the
folding state also when moving a subtree.

---------

Co-authored-by: Sebastian Flügge <seflue@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant