aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-30 04:28:09 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-30 04:28:09 +0530
commit0a5dc2e336cfa3aab64783fb44b0be519e46750c (patch)
treefed0f3c77d6d0fcd997527704cce5b33467afef8
parentef88a31a7ce632f35b538ff64466489902076883 (diff)
downloadnnn-0a5dc2e336cfa3aab64783fb44b0be519e46750c.tar.gz
Selection should work across contexts
-rw-r--r--src/nnn.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nnn.c b/src/nnn.c
index af53254..758f06d 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -936,7 +936,8 @@ static bool listselbuf(const char *path, char *newpath)
size_t pos;
uint oldpos = selbufpos;
- updateselbuf(path, newpath);
+ if (cfg.selmode)
+ updateselbuf(path, newpath);
if (!selbufpos)
return FALSE;
@@ -4141,7 +4142,7 @@ static void browse(char *ipath, const char *session)
char *path, *lastdir, *lastname, *dir, *tmp;
MEVENT event;
struct timespec mousetimings[2] = {{.tv_sec = 0, .tv_nsec = 0}, {.tv_sec = 0, .tv_nsec = 0} };
- bool currentmouse = 1;
+ bool currentmouse = 1, ctx_changed = FALSE;
atexit(dentfree);
@@ -4173,8 +4174,10 @@ static void browse(char *ipath, const char *session)
errexit();
begin:
- if (cfg.selmode && nselected && lastdir[0])
+ if (cfg.selmode && lastdir[0] && !ctx_changed)
updateselbuf(lastdir, newpath);
+ else if (ctx_changed)
+ ctx_changed = FALSE;
#ifdef LINUX_INOTIFY
if ((presel == FILTER || dir_changed) && inotify_wd >= 0) {
@@ -4577,6 +4580,11 @@ nochange:
continue;
}
+ if (cfg.selmode) {
+ updateselbuf(path, newpath);
+ ctx_changed = TRUE;
+ }
+
savecurctx(&cfg, path, dents[cur].name, r);
/* Reset the pointers */