1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

Update to use file size instead of line count

This commit is contained in:
raven42
2020-09-16 12:15:48 -05:00
parent be67ff7ae7
commit 14a86de04b
2 changed files with 7 additions and 5 deletions

View File

@@ -1158,14 +1158,16 @@ function! s:ProcessFile(fname, ftype) abort
return
endif
" If the file size limit it set, then check the linecount to see if
" If the file size limit it set, then check the file size to see if
" this file should be ignored or not.
if g:tagbar_file_size_limit > 0
let linecount = line('$')
let linecount = getfsize(expand('%'))
if linecount > g:tagbar_file_size_limit && !exists('b:tagbar_force_update')
call tagbar#debug#log('[ProcessFile] File size too large (' . linecount . ' lines) - limit set to ' . g:tagbar_file_size_limit)
call tagbar#debug#log('[ProcessFile] File size too large (' . linecount .
\ ' bytes) - limit set to ' . g:tagbar_file_size_limit)
if !exists('b:tagbar_file_exceeds_limit')
echom 'File size too large (' . linecount . ' lines) - Not processing file (see help for g:tagbar_file_size_limit).'
echom 'File size too large (' . linecount .
\ ' bytes) - Not processing file (see help for g:tagbar_file_size_limit).'
let b:tagbar_file_exceeds_limit = 1
endif
return

View File

@@ -891,7 +891,7 @@ g:tagbar_file_size_limit~
Default: 0
By default, all files are processed by tagbar. Setting this value to non-zero
will disable processing for any file with a line count greater than
will disable processing for any file with a byte count greater than
|g:tagbar_file_size_limit|. A message will be displayed once for a given buffer
if the limit is exceeded. The file can be forcefully updated with the
|tagbar#ForceUpdate()| function. If the value is set to 0, then the file will