]> Sergey Matveev's repositories - nnn.git/commitdiff
Hover next file on delete
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 28 Feb 2020 02:04:02 +0000 (07:34 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 28 Feb 2020 02:04:02 +0000 (07:34 +0530)
src/nnn.c

index 6c6c4050b4aa21159b0a7c6d8ea087839be4f79e..a7bd4f08c12b2cd39ab53b694ec0abf9d884b306 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5700,18 +5700,22 @@ nochange:
                                }
 
                                if (r == 'c') {
-                                       tmp = (g_listpath && xstrcmp(path, g_listpath) == 0) ? g_prefixpath : path;
+                                       tmp = (g_listpath && xstrcmp(path, g_listpath) == 0)
+                                             ? g_prefixpath : path;
                                        mkpath(tmp, dents[cur].name, newpath);
                                        xrm(newpath);
 
-                                       if (cur && access(newpath, F_OK) == -1) {
-                                               move_cursor(cur - 1, 0);
+                                       if (cfg.filtermode)
+                                               presel = FILTER;
+
+                                       if (access(newpath, F_OK) == 0) /* File not removed */
+                                               goto nochange;
+                                       else if (cur) {
+                                               cur += (cur != (ndents - 1)) ? 1 : -1;
                                                copycurname();
                                        } else
                                                lastname[0] = '\0';
 
-                                       if (cfg.filtermode)
-                                               presel = FILTER;
                                        goto begin;
                                }
                        }