]> git.notmuchmail.org Git - notmuch/blobdiff - vim/plugin/notmuch.vim
remove some debug code from NM_cmd_search()
[notmuch] / vim / plugin / notmuch.vim
index abb3cb468b54d75bdb8fa33bcc185cea785b8b2e..dfa4c432faca9d12c8693063f5ec2382e45fc862 100644 (file)
@@ -90,7 +90,7 @@ let g:notmuch_search_maps = {
 
 " --- --- bindings for show screen {{{2
 let g:notmuch_show_maps = {
-        \ '<C-P>':      ':call <SID>NM_show_prev(1)<CR>',
+        \ '<C-P>':      ':call <SID>NM_show_previous(1)<CR>',
         \ '<C-N>':      ':call <SID>NM_show_next(1)<CR>',
         \ 'q':          ':call <SID>NM_kill_this_buffer()<CR>',
         \
@@ -123,11 +123,8 @@ function! s:NM_cmd_search(words)
                 let cmd = cmd + ['--sort=oldest-first']
         endif
         let data = s:NM_run(cmd + a:words)
-        "let data = substitute(data, '27/27', '25/27', '')
-        "let data = substitute(data, '\[4/4\]', '[0/4]', '')
         let lines = split(data, "\n")
         let disp = copy(lines)
-        "call map(disp, 'substitute(v:val, "^thread:\\S* ", "", "")' )
         call map(disp, 's:NM_cmd_search_fmtline(v:val)')
 
         call <SID>NM_newBuffer('search', join(disp, "\n"))
@@ -301,7 +298,7 @@ function! s:NM_cmd_show(words)
 
 endfunction
 
-function! s:NM_show_prev(can_change_thread)
+function! s:NM_show_previous(can_change_thread)
         let info = b:nm_raw_info
         let lnum = line('.')
         for msg in reverse(copy(info['msgs']))
@@ -322,7 +319,7 @@ function! s:NM_show_prev(can_change_thread)
                 norm k
                 call <SID>NM_search_show_thread()
                 norm G
-                call <SID>NM_show_prev(0)
+                call <SID>NM_show_previous(0)
         else
                 echo 'No more messages.'
         endif
@@ -479,8 +476,10 @@ function! s:NM_cmd_show_parse(inlines)
                                         if (outlnum - mode_start) > g:notmuch_show_signature_lines_max
                                                 let mode_type = ''
                                         elseif part_end
-                                                let foldinfo = [ mode_type, mode_start, outlnum,
-                                                               \ printf('[ %d-line signature.  Press "s" to show. ]', outlnum - mode_start) ]
+                                                if mode_start != outlnum
+                                                        let foldinfo = [ mode_type, mode_start, outlnum-1,
+                                                                       \ printf('[ %d-line signature.  Press "s" to show. ]', outlnum - mode_start) ]
+                                                endif
                                                 let mode_type = ''
                                         endif
                                 endif
@@ -534,7 +533,7 @@ function! s:NM_cmd_show_parse(inlines)
                                         let hdr_start = msg['hdr_start']+1
                                         let hdr_end = len(info['disp'])
                                         let foldinfo = [ 'hdr', hdr_start, hdr_end,
-                                               \ printf('[ %d-line headers.  Press "h" to show. ]', hdr_end - hdr_start) ]
+                                               \ printf('[ %d-line headers.  Press "h" to show. ]', hdr_end + 1 - hdr_start) ]
                                         let msg['header'] = hdr
                                         let in_header = 0
                                         let hdr = {}