vim: preserve the 'show everything' flag when finding next/prev buffer

When show mode is invoked it could be displaying just the matched messages
or everything.  This flag is passed to NM_search_show_thread().  It is then
stored in a buffer variable, b:nm_show_everything, and used for subsequent
calls to NM_search_show_thread() triggered by <Space>, <C-n> and <C-p>.

Signed-off-by: Bart Trojanowski <bart@jukie.net>
This commit is contained in:
Bart Trojanowski 2009-11-27 21:31:12 -05:00 committed by Carl Worth
parent 0ed126fe19
commit 0ca1611416

View file

@ -275,6 +275,7 @@ function! s:NM_search_show_thread(everything)
call add(words, ')') call add(words, ')')
endif endif
call <SID>NM_cmd_show(words) call <SID>NM_cmd_show(words)
let b:nm_show_everything = a:everything
endfunction endfunction
function! s:NM_search_prompt() function! s:NM_search_prompt()
@ -430,6 +431,7 @@ function! s:NM_cmd_show(words)
endfunction endfunction
function! s:NM_show_previous(can_change_thread, find_matching) function! s:NM_show_previous(can_change_thread, find_matching)
let everything = exists('b:nm_show_everything') ? b:nm_show_everything : 0
let info = b:nm_raw_info let info = b:nm_raw_info
let lnum = line('.') let lnum = line('.')
for msg in reverse(copy(info['msgs'])) for msg in reverse(copy(info['msgs']))
@ -450,7 +452,7 @@ function! s:NM_show_previous(can_change_thread, find_matching)
call <SID>NM_kill_this_buffer() call <SID>NM_kill_this_buffer()
if line('.') > 1 if line('.') > 1
norm k norm k
call <SID>NM_search_show_thread() call <SID>NM_search_show_thread(everything)
norm G norm G
call <SID>NM_show_previous(0, a:find_matching) call <SID>NM_show_previous(0, a:find_matching)
else else
@ -479,10 +481,11 @@ function! s:NM_show_next(can_change_thread, find_matching)
endfunction endfunction
function! s:NM_show_next_thread() function! s:NM_show_next_thread()
let everything = exists('b:nm_show_everything') ? b:nm_show_everything : 0
call <SID>NM_kill_this_buffer() call <SID>NM_kill_this_buffer()
if line('.') != line('$') if line('.') != line('$')
norm j norm j
call <SID>NM_search_show_thread() call <SID>NM_search_show_thread(everything)
else else
echo 'No more messages.' echo 'No more messages.'
endif endif