Fix code review notes on 'norm zo':

- Only issue 'zo' if there is any fold at all.
        - Correct possible bug, code was using 'start_lnum' var, but it
          was changed/incremented which could lead to wrong results.
        - Use bang with norm, to prevent user re-mapping interfere with
          standard ones.
This commit is contained in:
Ivan Tishchenko 2015-12-01 22:41:50 +03:00
parent 5247de4a0b
commit 77fca9080c

View File

@ -1175,6 +1175,8 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header,
let whitespaces_in_first_line = ''
endif
let start_of_listing = start_lnum
" write new listing
let new_header = whitespaces_in_first_line
\ . substitute(g:vimwiki_rxH1_Template,
@ -1193,9 +1195,9 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header,
endif
" Open fold, if needed
if !is_fold_closed
exe start_lnum
norm zo
if !is_fold_closed && foldclosed(start_of_listing)
exe start_of_listing
norm! zo
endif
if is_cursor_after_listing