@@ -217,21 +217,21 @@ function! VimTodoListsCreateNewItemAbove()
217217endfunction
218218
219219
220- " Creates e new item below the current line
220+ " Creates a new item below the current line
221221function ! VimTodoListsCreateNewItemBelow ()
222222 normal ! o [ ]
223223 startinsert !
224224endfunction
225225
226226
227- " Creates e new item in the current line
227+ " Creates a new item in the current line
228228function ! VimTodoListsCreateNewItem ()
229229 normal ! 0 i [ ]
230230 startinsert !
231231endfunction
232232
233233
234- " Moves te cursor to the next item
234+ " Moves the cursor to the next item
235235function ! VimTodoListsGoToNextItem ()
236236 normal ! $
237237 silent ! exec ' /^\s*\[.\]'
@@ -240,7 +240,7 @@ function! VimTodoListsGoToNextItem()
240240endfunction
241241
242242
243- " Moves te cursor to the previous item
243+ " Moves the cursor to the previous item
244244function ! VimTodoListsGoToPreviousItem ()
245245 normal ! 0
246246 silent ! exec ' ?^\s*\[.\]'
@@ -253,14 +253,18 @@ endfunction
253253function ! VimTodoListsToggleItem ()
254254 let l: line = getline (' .' )
255255
256+ " Store current cursor position
257+ let l: cursor_pos = getcurpos ()
258+
256259 if VimTodoListsItemIsNotDone (l: line ) == 1
257260 call VimTodoListsForEachChild (line (' .' ), ' VimTodoListsSetItemDone' )
258261 elseif VimTodoListsItemIsDone (l: line ) == 1
259262 call VimTodoListsForEachChild (line (' .' ), ' VimTodoListsSetItemNotDone' )
260263 endif
261264
262- " Restore the cursor position
263- normal ! f [l
265+ " Restore the current position
266+ " Using the {curswant} value to set the proper column
267+ call cursor (l: cursor_pos [1 ], l: cursor_pos [4 ])
264268
265269 call VimTodoListsUpdateParent (line (' .' ))
266270endfunction
0 commit comments