Fix #23 - Remove usage of bufexists
`bufexists` can't handle the home directory(`~`). Instead use `bufnr` and `bufwinnr`, which are more appropriate. Also, I've decided to use `bufwinnr` instead of `bufnr` for checking if the file exists before loading it with `g:vebugger_view_source_cmd`, so it'll use `g:vebugger_view_source_cmd` if no window displays the buffer - even if the buffer is loaded. This fixes an inconsistency that was before, that `g:vebugger_view_source_cmd` would get invoked only if the file has no buffer loaded, if there is a buffer loaded it'll jump to it from the current window.
This commit is contained in:
parent
ee298e7390
commit
fa63556530
@ -180,7 +180,7 @@ function! s:standardThinkHandlers.moveToCurrentLine(readResult,debugger) dict
|
||||
exe 'sign unplace 1 file='.fnameescape(fnamemodify(a:debugger.state.std.location.file,':p'))
|
||||
endif
|
||||
let a:debugger.state.std.location=deepcopy(a:readResult.std.location)
|
||||
if !bufexists(a:readResult.std.location.file)
|
||||
if -1 == bufwinnr(a:readResult.std.location.file)
|
||||
exe get(g:, 'vebugger_view_source_cmd', 'new').' '.(a:readResult.std.location.file)
|
||||
endif
|
||||
call vebugger#std#updateMarksForFile(a:debugger.state,a:readResult.std.location.file)
|
||||
@ -258,7 +258,7 @@ endif
|
||||
"Update all the marks(currently executed line and breakpoints) for a file
|
||||
function! vebugger#std#updateMarksForFile(state,filename)
|
||||
let l:filename=fnamemodify(a:filename,":p")
|
||||
if bufexists(l:filename)
|
||||
if -1 < bufnr(l:filename)
|
||||
exe 'sign unplace 1 file='.fnameescape(fnamemodify(l:filename,':p'))
|
||||
exe 'sign unplace 2 file='.fnameescape(fnamemodify(l:filename,':p'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user