Skip to content

Commit

Permalink
fix: end line of a fold is a closed sub fold again
Browse files Browse the repository at this point in the history
  • Loading branch information
gh-liu committed Aug 7, 2024
1 parent 08635d4 commit 0503a68
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/fold_line/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ local function on_win(_, winid, bufnr, toprow, botrow)
---@return string|nil
local open_end_sign = function(i_level, cur_line, cur_line_finfo, next_line_finfo)
if cur_line_finfo.lines > 0 and i_level < cur_line_finfo.level - 1 then
cur_line = cur_line_finfo.start + cur_line_finfo.lines - 1
local next_line = cur_line_finfo.start + cur_line_finfo.lines
cur_line = next_line - 1
cur_line_finfo = foldinfos[cur_line]
next_line_finfo = foldinfos[cur_line + 1]
end

local cur_line_fstart = cur_line_finfo.start
Expand Down
51 changes: 51 additions & 0 deletions tests/screenshots/tests-test_fold_line.lua---__test_003
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
--|---------|---------|---------|---------|---------|---------|---------|---------|
01|┌fold
02|│ ┌fold
03|│ │fold
04|│ │fold
05|│ │ ┌fold
06|│ │ │fold
07|│----- └ lines:╘fold···························································
08|└fold
09|~
10|~
11|~
12|~
13|~
14|~
15|~
16|~
17|~
18|~
19|~
20|~
21|~
22|~
23|tests/testcases/test_003.txt 7,2-1 All
24|

--|---------|---------|---------|---------|---------|---------|---------|---------|
01|01111111111111111111111111111111111111111111111111111111111111111111111111111111
02|01111111011111111111111111111111111111111111111111111111111111111111111111111111
03|01111111011111111111111111111111111111111111111111111111111111111111111111111111
04|01111111011111111111111111111111111111111111111111111111111111111111111111111111
05|01111111011111112111111111111111111111111111111111111111111111111111111111111111
06|01111111011111112111111111111111111111111111111111111111111111111111111111111111
07|00000000000000003000000000000000000000000000000000000000000000000000000000000000
08|01111111111111111111111111111111111111111111111111111111111111111111111111111111
09|22222222222222222222222222222222222222222222222222222222222222222222222222222222
10|22222222222222222222222222222222222222222222222222222222222222222222222222222222
11|22222222222222222222222222222222222222222222222222222222222222222222222222222222
12|22222222222222222222222222222222222222222222222222222222222222222222222222222222
13|22222222222222222222222222222222222222222222222222222222222222222222222222222222
14|22222222222222222222222222222222222222222222222222222222222222222222222222222222
15|22222222222222222222222222222222222222222222222222222222222222222222222222222222
16|22222222222222222222222222222222222222222222222222222222222222222222222222222222
17|22222222222222222222222222222222222222222222222222222222222222222222222222222222
18|22222222222222222222222222222222222222222222222222222222222222222222222222222222
19|22222222222222222222222222222222222222222222222222222222222222222222222222222222
20|22222222222222222222222222222222222222222222222222222222222222222222222222222222
21|22222222222222222222222222222222222222222222222222222222222222222222222222222222
22|22222222222222222222222222222222222222222222222222222222222222222222222222222222
23|44444444444444444444444444444444444444444444444444444444444444444444444444444444
24|11111111111111111111111111111111111111111111111111111111111111111111111111111111
12 changes: 12 additions & 0 deletions tests/testcases/test_003.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fold
fold
fold
fold
fold
fold
fold
fold
fold
fold
fold
fold
23 changes: 23 additions & 0 deletions tests/testcases/test_003.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
setlocal fdm=manual
setlocal fde=0
setlocal fmr={{{,}}}
setlocal fdi=#
setlocal fdl=99
setlocal fml=1
setlocal fdn=20
setlocal fen
silent! normal! zE
7,11fold
5,11fold
2,11fold
1,12fold
let &fdl = &fdl
1
normal! zo
2
normal! zo
5
normal! zo
7
normal! zc
" vim: set ft=vim :

0 comments on commit 0503a68

Please sign in to comment.