@@ -558,10 +558,7 @@ endfun
558558fun ! s: set_checkbox (lnum, marker)
559559 let l: initpos = getpos (' .' )
560560 let l: pos = s: find_checkbox_position (a: lnum )
561- let l: checkbox_content = getline (a: lnum )[l: pos ]
562- " select inside checkbox
563- call setpos (' .' , [0 , a: lnum , l: pos ])
564- execute ' normal! ci[' . a: marker
561+ call s: replace_char_in_line (a: lnum , l: pos , a: marker )
565562 call setpos (' .' , l: initpos )
566563endfun
567564
@@ -1244,6 +1241,13 @@ fun! s:sibling_checkbox_status(lnum)
12441241 return l: checkbox_markers [l: completion ]
12451242endfun
12461243
1244+ fun ! s: replace_char_in_line (lnum, chari, item)
1245+ let l: curline = getline (a: lnum )
1246+ let l: before = strcharpart (l: curline , 0 , a: chari )
1247+ let l: after = strcharpart (l: curline , a: chari + 1 )
1248+ call setline (a: lnum , l: before . a: item . l: after )
1249+ endfun
1250+
12471251" ------------------------------------------------------- }}}
12481252
12491253" Restore previous external compatibility options --------- {{{
0 commit comments