File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1238,9 +1238,22 @@ fun! s:sibling_checkbox_status(lnum)
12381238 endif
12391239 endif
12401240 endfor
1241- let l: divisions = len (l: checkbox_markers ) - 1.0
1242- let l: completion = float2nr (ceil (l: divisions * l: checked / l: num_siblings ))
1243- return l: checkbox_markers [l: completion ]
1241+ " we are interested in the number of markings that can give us sets of
1242+ " percentage to group the markings
1243+ let l: divisions = len (l: checkbox_markers ) - 2.0
1244+ " Border case no need to calculate and it fixex the problem of the
1245+ " calculation below never being able to get this last number.
1246+ if l: checked == # l: num_siblings
1247+ return l: checkbox_markers [len (l: checkbox_markers ) - 1 ]
1248+ else
1249+ " 1.0 multiplication is to have float calculations.
1250+ " The calculation looks for a multiple of a percentage class to define
1251+ " which marker to use.
1252+ let l: ratio_checked = 1.0 * l: checked / l: num_siblings
1253+ let l: persentage_class = 1.0 / l: divisions
1254+ let l: completion = float2nr (ceil (l: ratio_checked / l: persentage_class ))
1255+ return l: checkbox_markers [l: completion ]
1256+ endif
12441257endfun
12451258
12461259fun ! s: replace_char_in_line (lnum, chari, item)
You can’t perform that action at this time.
0 commit comments