Skip to content

Commit

Permalink
GH-183 - Clear cache when switching tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZNielsen committed Sep 20, 2023
1 parent 74573b6 commit e702bf9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions autoload/minimap/vim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ function! s:win_enter_handler() abort
endif
endfunction

function! s:tab_leave_handler() abort
" Nuke our state - we don't keep a per-tab cache so we need to rebuild on
" any tab change
let s:last_pos = {}
let s:last_range = {}
let s:win_info = {}
let s:len_cache = {}
endfunction

function! s:get_longest_line_cmd() abort
if has('mac')
return 'gwc'
Expand Down Expand Up @@ -204,6 +213,7 @@ function! s:open_window() abort
\ call s:minimap_update_color_search(getcmdline())
endif
autocmd VimEnter,DiffUpdated * call s:handle_autocmd(7)
autocmd TabLeave * call s:handle_autocmd(8)
augroup END

" https://github.com/neovim/neovim/issues/6211
Expand Down Expand Up @@ -266,6 +276,9 @@ function! s:handle_autocmd(cmd) abort
elseif a:cmd == 7 " VimEnter,DiffUpdated *
" echom 'VimEnter,DiffUpdated *'
call s:minimap_diffoff()
elseif a:cmd == 8 " TabLeave *
echom 'TabLeave *'
call s:tab_leave_handler()
endif
endif
endfunction
Expand Down

0 comments on commit e702bf9

Please sign in to comment.