<commit_before>" MIT License. Copyright (c) 2013-2018 <NAME> et al.
" vim: et ts=2 sts=2 sw=2

scriptencoding utf-8

let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
let s:current_tabnr = -1
let s:current_modified = 0

function! airline#extensions#tabline#tabs#off()
  augroup airline_tabline_tabs
    autocmd!
  augroup END
endfunction

function! airline#extensions#tabline#tabs#on()
  augroup airline_tabline_tabs
    autocmd!
    autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate()
  augroup END
endfunction

function! airline#extensions#tabline#tabs#invalidate()
  let s:current_bufnr = -1
endfunction

function! s:evaluate_tabline(tabline)
  let tabline = a:tabline
  let tabline = substitute(tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g')
  let tabline = substitute(tabline, '%#[^#]\+#', '', 'g')
  let tabline = substitute(tabline, '%(\([^)]\+\)%)', '\1', 'g')
  let tabline = substitute(tabline, '%\d\+[TX]', '', 'g')
  let tabline = substitute(tabline, '%=', '', 'g')
  let tabline = substitute(tabline, '%\d*\*', '', 'g')
  return tabline
endfunction

function! s:get_title(tab_nr_type, i)
  let val = '%('

  if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
    let val .= airline#extensions#tabline#tabs#tabnr_formatter(a:tab_nr_type, a:i)
  endif

  return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)'
endfunction

" Compatibility wrapper for strchars, in case this vim version does not
" have it natively
function! s:strchars(str)
  if exists('*strchars')
    return strchars(a:str)
  else
    return strlen(substitute(a:str, '.', 'a', 'g'))
  endif
endfunction

function! airline#extensions#tabline#tabs#get()
  let curbuf = bufnr('%')
  let curtab = tabpagenr()
  try
    call airline#extensions#tabline#tabs#map_keys()
  catch
    " no-op
  endtry
  if curbuf == s:current_bufnr && curtab == s:current_tabnr && &columns == s:column_width
    if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
      return s:current_tabline
    endif
  endif

  let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
  let b = airline#extensions#tabline#new_builder()

  call airline#extensions#tabline#add_label(b, 'tabs')

  let tabs_position = b.get_position()

  call b.add_section('airline_tabfill', '')
  call b.split()
  call b.add_section('airline_tabfill', '')

  if get(g:, 'airline#extensions#tabline#show_close_button', 1)
    call b.add_section('airline_tab_right', ' %999X'.
          \ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
  endif

  if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1
    let buffers = tabpagebuflist(curtab)
    for nr in buffers
      let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
      call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
    endfor
    call airline#extensions#tabline#add_label(b, 'buffers')
  endif

  let b_tabline = s:evaluate_tabline(b.build())
  let num_tabs = tabpagenr('$')
  let left_tab = curtab - 1
  let right_tab = curtab + 1
  let left_position = tabs_position
  let right_position = tabs_position + 1
  let remaining_space = &columns - s:strchars(s:evaluate_tabline(b.build()))

  let left_sep_size = s:strchars(s:evaluate_tabline(b._context.left_sep))
  let left_alt_sep_size = s:strchars(s:evaluate_tabline(b._context.left_alt_sep))

  let skipped_tabs_marker = get(g:, 'airline#extensions#tabline#overflow_marker', g:airline_symbols.ellipsis)
  let skipped_tabs_marker_size = s:strchars(s:evaluate_tabline(skipped_tabs_marker))
  " The left marker will have left_alt_sep, and the right will have left_sep.
  let remaining_space -= 2 * skipped_tabs_marker_size + left_sep_size + left_alt_sep_size

  " Add the current tab
  let tab_title = s:get_title(tab_nr_type, curtab)
  let remaining_space -= s:strchars(s:evaluate_tabline(tab_title))<commit_msg>Remove unused variable b_tabline<commit_after>" MIT License. Copyright (c) 2013-2018 <NAME> et al.
" vim: et ts=2 sts=2 sw=2

scriptencoding utf-8

let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
let s:current_tabnr = -1
let s:current_modified = 0

function! airline#extensions#tabline#tabs#off()
  augroup airline_tabline_tabs
    autocmd!
  augroup END
endfunction

function! airline#extensions#tabline#tabs#on()
  augroup airline_tabline_tabs
    autocmd!
    autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate()
  augroup END
endfunction

function! airline#extensions#tabline#tabs#invalidate()
  let s:current_bufnr = -1
endfunction

function! s:evaluate_tabline(tabline)
  let tabline = a:tabline
  let tabline = substitute(tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g')
  let tabline = substitute(tabline, '%#[^#]\+#', '', 'g')
  let tabline = substitute(tabline, '%(\([^)]\+\)%)', '\1', 'g')
  let tabline = substitute(tabline, '%\d\+[TX]', '', 'g')
  let tabline = substitute(tabline, '%=', '', 'g')
  let tabline = substitute(tabline, '%\d*\*', '', 'g')
  return tabline
endfunction

function! s:get_title(tab_nr_type, i)
  let val = '%('

  if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
    let val .= airline#extensions#tabline#tabs#tabnr_formatter(a:tab_nr_type, a:i)
  endif

  return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)'
endfunction

" Compatibility wrapper for strchars, in case this vim version does not
" have it natively
function! s:strchars(str)
  if exists('*strchars')
    return strchars(a:str)
  else
    return strlen(substitute(a:str, '.', 'a', 'g'))
  endif
endfunction

function! airline#extensions#tabline#tabs#get()
  let curbuf = bufnr('%')
  let curtab = tabpagenr()
  try
    call airline#extensions#tabline#tabs#map_keys()
  catch
    " no-op
  endtry
  if curbuf == s:current_bufnr && curtab == s:current_tabnr && &columns == s:column_width
    if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
      return s:current_tabline
    endif
  endif

  let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
  let b = airline#extensions#tabline#new_builder()

  call airline#extensions#tabline#add_label(b, 'tabs')

  let tabs_position = b.get_position()

  call b.add_section('airline_tabfill', '')
  call b.split()
  call b.add_section('airline_tabfill', '')

  if get(g:, 'airline#extensions#tabline#show_close_button', 1)
    call b.add_section('airline_tab_right', ' %999X'.
          \ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
  endif

  if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1
    let buffers = tabpagebuflist(curtab)
    for nr in buffers
      let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
      call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
    endfor
    call airline#extensions#tabline#add_label(b, 'buffers')
  endif

  let num_tabs = tabpagenr('$')
  let left_tab = curtab - 1
  let right_tab = curtab + 1
  let left_position = tabs_position
  let right_position = tabs_position + 1
  let remaining_space = &columns - s:strchars(s:evaluate_tabline(b.build()))

  let left_sep_size = s:strchars(s:evaluate_tabline(b._context.left_sep))
  let left_alt_sep_size = s:strchars(s:evaluate_tabline(b._context.left_alt_sep))

  let skipped_tabs_marker = get(g:, 'airline#extensions#tabline#overflow_marker', g:airline_symbols.ellipsis)
  let skipped_tabs_marker_size = s:strchars(s:evaluate_tabline(skipped_tabs_marker))
  " The left marker will have left_alt_sep, and the right will have left_sep.
  let remaining_space -= 2 * skipped_tabs_marker_size + left_sep_size + left_alt_sep_size

  " Add the current tab
  let tab_title = s:get_title(tab_nr_type, curtab)
  let remaining_space -= s:strchars(s:evaluate_tabline(tab_title))
{'fraction_non_alphanumeric': 0.14274799439704572, 'fraction_numerical': 0.007640392206799949, 'mean_word_length': 5.2283901665344965, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4882320', 'n_tokens_mistral': 2959, 'n_tokens_neox': 2819, 'n_words': 577}