wordcount: only try to access buffer content in the actual current buffer

closes #1955
(this actually needs Vim patch 8.1.1372 to work properly)
This commit is contained in:
Christian Brabandt 2019-08-20 14:28:54 +02:00
parent 3f82d3a975
commit af96e9745f
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -6,6 +6,9 @@ scriptencoding utf-8
" get wordcount {{{1
if exists('*wordcount')
function! s:get_wordcount(visual_mode_active)
if get(g:, 'actual_curbuf', '') != bufnr('')
return
endif
let query = a:visual_mode_active ? 'visual_words' : 'words'
return get(wordcount(), query, 0)
endfunction