// Note, if a buffer for that file already exists, use :badd to
// edit that buffer, to not lose folding information (:edit resets
// folds in other buffers)
- if (fputs("if bufexists(\"", fd) < 0
+ if (fputs("if bufexists(fnamemodify(\"", fd) < 0
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
- || fputs("\") | buffer ", fd) < 0
+ || fputs("\", \":p\")) | buffer ", fd) < 0
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
|| fputs(" | else | edit ", fd) < 0
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
let count1 = 0
let count2 = 0
let count2buf = 0
+ let bufexists = 0
for line in lines
if line =~ 'edit \f*Xtest1$'
let count1 += 1
if line =~ 'buffer \f\{-}Xtest2'
let count2buf += 1
endif
+ if line =~ 'bufexists(fnamemodify(.*, ":p")'
+ let bufexists += 1
+ endif
endfor
call assert_equal(1, count1, 'Xtest1 count')
call assert_equal(2, count2, 'Xtest2 count')
call assert_equal(2, count2buf, 'Xtest2 buffer count')
+ call assert_equal(2, bufexists)
close
bwipe!