Permalink
Browse files

Fixed bug where partial mode was entered incorrectly.

Some filetypes source other filetypes in their ftplugin. If that filetype called
write#restart then futher filetypes would not get their say. If the first one
wanted full mode and the later one wanted partial mode (e.g. text is sourced and
then markdown is sourced) then the filetype would be stuck in full mode.

write#restart() now only exists if b:writing *and* b:write_ft == &ft.
  • Loading branch information...
1 parent f4da67c commit d98ba01a8823adb2e22b837a8a1d73b41566f3f3 @Soares committed Oct 12, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 autoload/write.vim
View
9 autoload/write.vim
@@ -49,9 +49,14 @@ endfunction
" Toggles writing mode only if writing has never been set for this buffer
" @param {string} bang Whether or not to force full writing mode.
function! write#restart(bang)
- if !exists('b:writing')
- call write#start(a:bang)
+ if exists('b:write_ft') && b:write_ft == &ft
+ return
endif
+ if exists('b:writing') && b:writing
+ call write#stop()
+ endif
+ call write#start(a:bang)
+ let b:write_ft = &ft
endfunction

0 comments on commit d98ba01

Please sign in to comment.