-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not jump if the file name is invalid.
Fixes #16 Signed-off-by: Gregory L. Dietsche <[email protected]>
- Loading branch information
1 parent
104ca72
commit 9ee7fe2
Showing
1 changed file
with
9 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,11 +27,6 @@ if !exists('g:lastplace_ignore_buftype') | |
endif | ||
|
||
fu! s:lastplace() | ||
"if the file does not exist on disk (a new, unsaved file) then do nothing | ||
if empty(glob(@%)) | ||
return | ||
endif | ||
|
||
if index(split(g:lastplace_ignore_buftype, ","), &buftype) != -1 | ||
return | ||
endif | ||
|
@@ -40,6 +35,15 @@ fu! s:lastplace() | |
return | ||
endif | ||
|
||
try | ||
"if the file does not exist on disk (a new, unsaved file) then do nothing | ||
if empty(glob(@%)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
farmergreg
Author
Owner
|
||
return | ||
endif | ||
catch | ||
return | ||
endtry | ||
|
||
if line("'\"") > 0 && line("'\"") <= line("$") | ||
"if the last edit position is set and is less than the | ||
"number of lines in this buffer. | ||
|
I’m surprised by this test (or the mismatch with the comment): if I have a file named
a
in a directory and that I create a file named?
or*
, the test will be false even if this is a new unsaved file.empty(filereadable(@%))
would be better (if the file exists but is not readable, we might just as well stop right there), wouldn’t it?