Skip to content

org-next-visible-heading goes to invisible headings #774

@SlayerOfTheBad

Description

@SlayerOfTheBad

Describe the bug

When org-next-visible-heading (OrgMappings:next_visible_heading()) is called, the cursor is moved to the next heading, regardless of whether it is visible or not.

Steps to reproduce

Assume a file

* Heading 1
** Heading 1.1
*** Heading 1.1.1
    Loremus Ipsumus
*** Heading 1.1.2
    Some other fake text
** Heading 1.2
   Heading 1.2 contains some other text
** Heading 1.3
*** Heading 1.3.1
    There's a link to [[https://google.com][Google]] in here.
*** Heading 1.3.2
    And here's a link to [[https://gitlab.com][Gitlab]]!

Collapse this to show as

* Heading 1
** Heading 1.1 ...
** Heading 1.2 ...
** Heading 1.3 ...
  1. Go to the first line. (vim.cmd([[norm gg]]))
  2. Invoke OrgMappings:next_visible_heading twice. (vim.cmd([[norm }}]]))

Actual behaviour:
Cursor is present at ** Heading 1.1 (Internally at *** Heading 1.1.1)

Expected behavior

Have cursor present at ** Heading 1.2.

Emacs functionality

Exists in Emacs Orgmode - Moves to ** Heading 1.2

Minimal init.lua

Not relevant for reproducing the bug.

Screenshots and recordings

cut-nvim.webm
cut-emacs.webm

OS / Distro

Arch Linux & Ubuntu 24.04

Neovim version/commit

NVIM v0.10.1 & NVIM v0.10.1-dev-9+g671073e71

Additional context

I have fixed this already and created a pull request.
#773

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