Skip to content

Commit

Permalink
feat(indentscope): show indent guide on wrapped lines
Browse files Browse the repository at this point in the history
Resolve #635.
  • Loading branch information
gpanders authored and echasnovski committed Apr 11, 2024
1 parent 2bddcd5 commit ac3a678
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/mini/indentscope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,8 @@ H.make_draw_function = function(indicator, opts)
virt_text_pos = 'overlay',
}

if vim.fn.has('nvim-0.10') == 1 then extmark_opts.virt_text_repeat_linebreak = true end

local current_event_id = opts.event_id

return function(l)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--|---------|--
01|aa
02| aa
03| ╎aa
04| ╎ aa
05| ╎ aa
06| ╎ aaaaaaaaa
07| ╎ aaa
08| ╎aa
09| aa
10|aa
11|~
12|~
13|~
14|< [+] 6,2
15|

--|---------|--
01|000000000000
02|000000000000
03|010000000000
04|010000000000
05|010000000000
06|010000000000
07|010000000000
08|010000000000
09|000000000000
10|000000000000
11|222222222222
12|222222222222
13|222222222222
14|333333333333
15|444444444444
15 changes: 15 additions & 0 deletions tests/test_indentscope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,21 @@ T['draw()']['does not round time of every animation step'] = function()
child.expect_screenshot()
end

T['draw()']['shows symbols on wrapped lines'] = function()
-- Add a long line of text. Set 'breakindent' and 'breakindentopt' to ensure
-- the wrapped line has the same indent as the current line
set_cursor(6, 1)
child.cmd('normal! 10Aa')
child.wo.breakindentopt = 'min:0'
child.wo.breakindent = true

-- Move the cursor back to the original position
set_cursor(6, 1)
child.lua('MiniIndentscope.config.draw.animation = function() return 0 end')
child.lua('MiniIndentscope.draw()')
child.expect_screenshot()
end

T['undraw()'] = new_set({
hooks = {
pre_case = function()
Expand Down

0 comments on commit ac3a678

Please sign in to comment.