Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions plugin/bullets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,22 @@ fun! s:sibling_checkbox_status(lnum)
endif
endif
endfor
let l:divisions = len(l:checkbox_markers) - 1.0
let l:completion = float2nr(ceil(l:divisions * l:checked / l:num_siblings))
return l:checkbox_markers[l:completion]
" we are interested in the number of markings that can give us sets of
" percentage to group the markings
let l:divisions = len(l:checkbox_markers) - 2.0
" Border case no need to calculate and it fixex the problem of the
" calculation below never being able to get this last number.
if l:checked ==# l:num_siblings
return l:checkbox_markers[len(l:checkbox_markers) - 1]
else
" 1.0 multiplication is to have float calculations.
" The calculation looks for a multiple of a percentage class to define
" which marker to use.
let l:ratio_checked = 1.0 * l:checked / l:num_siblings
let l:persentage_class = 1.0 / l:divisions
let l:completion = float2nr(ceil(l:ratio_checked / l:persentage_class))
return l:checkbox_markers[l:completion]
endif
endfun

fun! s:replace_char_in_line(lnum, chari, item)
Expand Down
Loading