Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions plugin/dirdiff.vim
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,17 @@ function! <SID>DirDiffOpen()
return
endif

let line = getline(".")
let mode = 0
if <SID>IsDiffer(line)
let mode = 2
elseif <SID>IsOnly(line)
let mode = 1
else
echo "There is no diff at the current line! "
return
endif

" First dehighlight the last marked line
call <SID>DeHighlightLine()

Expand All @@ -479,7 +490,6 @@ function! <SID>DirDiffOpen()
" Change back to the right window
call <SID>GotoDiffWindow()

let line = getline(".")
let b:currentDiff = line(".")

let previousFileA = exists("s:FilenameA") ? s:FilenameA : ""
Expand All @@ -492,7 +502,7 @@ function! <SID>DirDiffOpen()
let s:FilenameA = <SID>EscapeFileName(fileA)
let s:FilenameB = <SID>EscapeFileName(fileB)

if <SID>IsOnly(line)
if mode == 1
" We open the file
let fileSrc = <SID>ParseOnlySrc(line)
if (fileSrc == "A")
Expand Down Expand Up @@ -524,8 +534,7 @@ function! <SID>DirDiffOpen()
exe("resize " . g:DirDiffWindowSize)
exe (b:currentDiff)
let s:LastMode = fileSrc
elseif <SID>IsDiffer(line)

elseif mode == 2
if exists("s:LastMode")
if s:LastMode == 2
call <SID>Drop(previousFileA)
Expand Down Expand Up @@ -564,7 +573,7 @@ function! <SID>DirDiffOpen()
exe ("normal z.")
let s:LastMode = 2
else
echo "There is no diff at the current line!"
echo "should not happen"
endif
endfunction

Expand Down