Skip to content

foldexpr '<1' results in a level-3 fold #15104

@lilydjwg

Description

@lilydjwg

Steps to reproduce

  1. Edit the following file with vim --clean:
/
├── e
│   └── d
│       └── c
│           ├── _a
│           └── _b
└── f

x directories, y files
  1. source the following vimscript:
let s:fold_results = [ '>1', '>2', '>3', '>4', '4', '<4', '<1', '0', '0' ]

function FoldExpr(lnum)
  return s:fold_results[a:lnum-1]
endfunction

set foldmethod=expr foldexpr=FoldExpr(v:lnum)
  1. observe that line 7 is at level 3

Expected behaviour

<1 should end any higher-level folds and end at level 1.

Version of Vim

9.1.514

Environment

Arch Linux, GNOME Termianl / GTK GUI

Logs and stack traces

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions