glx on a list item creates a checked checkbox
... instead of an unchecked one.
This commit is contained in:
parent
12349b8cb6
commit
2fb0e17adb
@ -841,13 +841,13 @@ endfunction
|
|||||||
|
|
||||||
"Creates checkbox in a list item.
|
"Creates checkbox in a list item.
|
||||||
"Returns: 1 if successful
|
"Returns: 1 if successful
|
||||||
function! s:create_cb(item)
|
function! s:create_cb(item, start_rate)
|
||||||
if a:item.type == 0 || a:item.cb != ''
|
if a:item.type == 0 || a:item.cb != ''
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let new_item = a:item
|
let new_item = a:item
|
||||||
let new_item.cb = vimwiki#vars#get_syntaxlocal('listsyms_list')[0]
|
let new_item.cb = s:rate_to_state(a:start_rate)
|
||||||
call s:substitute_rx_in_line(new_item.lnum,
|
call s:substitute_rx_in_line(new_item.lnum,
|
||||||
\ vimwiki#u#escape(new_item.mrkr) . '\zs\ze', ' [' . new_item.cb . ']')
|
\ vimwiki#u#escape(new_item.mrkr) . '\zs\ze', ' [' . new_item.cb . ']')
|
||||||
|
|
||||||
@ -894,9 +894,9 @@ function! s:change_cb(from_line, to_line, new_rate)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
"Toggles checkbox between two states in the lines of the given range,
|
" Toggles checkbox between two states in the lines of the given range, creates chceckboxes (with
|
||||||
"creates chceckboxes if there aren't any.
|
" a:start_rate as state) if there aren't any.
|
||||||
function! s:toggle_create_cb(from_line, to_line, state1, state2)
|
function! s:toggle_create_cb(from_line, to_line, state1, state2, start_rate)
|
||||||
let from_item = s:get_corresponding_item(a:from_line)
|
let from_item = s:get_corresponding_item(a:from_line)
|
||||||
if from_item.type == 0
|
if from_item.type == 0
|
||||||
return
|
return
|
||||||
@ -908,7 +908,7 @@ function! s:toggle_create_cb(from_line, to_line, state1, state2)
|
|||||||
let parent_items_of_lines = []
|
let parent_items_of_lines = []
|
||||||
for cur_ln in range(from_item.lnum, a:to_line)
|
for cur_ln in range(from_item.lnum, a:to_line)
|
||||||
let cur_item = s:get_item(cur_ln)
|
let cur_item = s:get_item(cur_ln)
|
||||||
let success = s:create_cb(cur_item)
|
let success = s:create_cb(cur_item, a:start_rate)
|
||||||
|
|
||||||
if success
|
if success
|
||||||
let cur_parent_item = s:get_parent(cur_item)
|
let cur_parent_item = s:get_parent(cur_item)
|
||||||
@ -974,14 +974,14 @@ endfunction
|
|||||||
"Toggles checkbox between [ ] and [X] or creates one
|
"Toggles checkbox between [ ] and [X] or creates one
|
||||||
"in the lines of the given range
|
"in the lines of the given range
|
||||||
function! vimwiki#lst#toggle_cb(from_line, to_line)
|
function! vimwiki#lst#toggle_cb(from_line, to_line)
|
||||||
return s:toggle_create_cb(a:from_line, a:to_line, 100, 0)
|
return s:toggle_create_cb(a:from_line, a:to_line, 100, 0, 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
"Toggles checkbox between [ ] and [-] or creates one
|
"Toggles checkbox between [ ] and [-] or creates one
|
||||||
"in the lines of the given range
|
"in the lines of the given range
|
||||||
function! vimwiki#lst#toggle_rejected_cb(from_line, to_line)
|
function! vimwiki#lst#toggle_rejected_cb(from_line, to_line)
|
||||||
return s:toggle_create_cb(a:from_line, a:to_line, -1, 0)
|
return s:toggle_create_cb(a:from_line, a:to_line, -1, 0, -1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@ -1381,7 +1381,7 @@ function! s:clone_marker_from_to(from, to)
|
|||||||
let new_indent = ( vimwiki#vars#get_syntaxlocal('recurring_bullets') ? 0 : indent(a:from) )
|
let new_indent = ( vimwiki#vars#get_syntaxlocal('recurring_bullets') ? 0 : indent(a:from) )
|
||||||
call s:set_indent(a:to, new_indent)
|
call s:set_indent(a:to, new_indent)
|
||||||
if item_from.cb != ''
|
if item_from.cb != ''
|
||||||
call s:create_cb(s:get_item(a:to))
|
call s:create_cb(s:get_item(a:to), 0)
|
||||||
call s:update_state(s:get_parent(s:get_item(a:to)))
|
call s:update_state(s:get_parent(s:get_item(a:to)))
|
||||||
endif
|
endif
|
||||||
if item_from.type == 2
|
if item_from.type == 2
|
||||||
|
Loading…
Reference in New Issue
Block a user