Permalink
Browse files

s:SelectMRU(): Don't use s:FindIndex() and make sure to use the curre…

…ct mru list (fixes #27)
  • Loading branch information...
1 parent 8f47107 commit a9a6103b1bd8e96040a0ea552cb559d7ab5f6a4f @tomtom committed Nov 27, 2012
Showing with 14 additions and 16 deletions.
  1. +14 −16 plugin/tmru.vim
View
@@ -360,16 +360,26 @@ function! s:SelectMRU()
" TLogDBG "SelectMRU#5"
" TLogVAR bs
if !empty(bs)
+ let modified_mru = 0
for bf in bs
" TLogVAR bf
if !TmruEdit(bf)
- let bi = s:FindIndex(mru, bf)
+ if modified_mru == 0
+ let mru0 = s:MruRetrieve()
+ let filenames0 = s:GetFilenames(mru0)
+ endif
+ let modified_mru += 1
+ let bi = s:FilenameIndex(filenames0, bf)
" TLogVAR bi
- call remove(mru, bi)
- call s:MruStore(mru, {})
+ if bi != -1
+ call remove(mru0, bi)
+ endif
endif
endfor
- return 1
+ if modified_mru > 0
+ call s:MruStore(mru0, {})
+ endif
+ return modified_mru < len(bs)
endif
endif
return 0
@@ -401,18 +411,6 @@ function! s:AList2Dict(mru)
endf
-function! s:FindIndex(mru, filename)
- let i = 0
- for item in a:mru
- if item[0] == a:filename
- return i
- endif
- let i += 1
- endif
- return -1
-endf
-
-
function! s:EditMRU()
let mru = s:MruRetrieve()
let filenames0 = s:GetFilenames(mru)

0 comments on commit a9a6103

Please sign in to comment.