mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
Avoid trying to edit a non-existing file (#477)
The previous implementation was inconsistent, sometimes it would inherit the name of the parent folder of the current directory. Other scenarios i encountered were: 1. Yield a empty search result, and try to edit. It would seemingly randomly select a file or folder 2. What would happen in a root path without any files residing?
This commit is contained in:
parent
9cf77708a1
commit
75f6d5d735
1 changed files with 2 additions and 0 deletions
|
@ -5453,6 +5453,8 @@ nochange:
|
||||||
|
|
||||||
if (ndents)
|
if (ndents)
|
||||||
mkpath(path, dents[cur].name, newpath);
|
mkpath(path, dents[cur].name, newpath);
|
||||||
|
else if (sel == SEL_EDIT) /* Avoid trying to edit a non-existing file */
|
||||||
|
goto nochange;
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case SEL_REDRAW:
|
case SEL_REDRAW:
|
||||||
|
|
Loading…
Add table
Reference in a new issue