Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #100 to correctly mark parent checkbox #101

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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 @@ -1334,9 +1334,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