Show all selected files on M

This commit is contained in:
Arun Prakash Jana 2019-11-29 08:38:11 +05:30
parent 35b3cf3b1f
commit 965499c671
No known key found for this signature in database
GPG key ID: A75979F35C080412
2 changed files with 14 additions and 7 deletions

View file

@ -211,8 +211,8 @@ The list below is from the **dev branch**. Press <kbd>?</kbd> in `nnn` to see th
FILES FILES
^O Open with... n Create new/link ^O Open with... n Create new/link
D File details ^R F2 Rename/duplicate D File details ^R F2 Rename/duplicate
Space ^J/a Select entry/all r Batch rename Space ^J/a Sel toggle/all r Batch rename
m ^K Sel range, clear M Show sel buf m ^K Sel range, clear M List selection
P Copy selection K Edit, flush sel P Copy selection K Edit, flush sel
V Move selection w Copy/move sel as V Move selection w Copy/move sel as
X Del selection ^X Del entry X Del selection ^X Del entry

View file

@ -581,6 +581,7 @@ static int dentfind(const char *fname, int n);
static void move_cursor(int target, int ignore_scrolloff); static void move_cursor(int target, int ignore_scrolloff);
static inline bool getutil(char *util); static inline bool getutil(char *util);
static size_t mkpath(const char *dir, const char *name, char *out); static size_t mkpath(const char *dir, const char *name, char *out);
static void updateselbuf(const char *path, char *newpath);
/* Functions */ /* Functions */
@ -929,17 +930,22 @@ static size_t seltofile(int fd, uint *pcount)
} }
/* List selection from selection buffer */ /* List selection from selection buffer */
static bool listselbuf(void) static bool listselbuf(const char *path, char *newpath)
{ {
int fd; int fd;
size_t pos; size_t pos;
uint oldpos = selbufpos;
updateselbuf(path, newpath);
if (!selbufpos) if (!selbufpos)
return FALSE; return FALSE;
fd = create_tmp_file(); fd = create_tmp_file();
if (fd == -1) if (fd == -1) {
selbufpos = oldpos;
return FALSE; return FALSE;
}
pos = seltofile(fd, NULL); pos = seltofile(fd, NULL);
@ -948,6 +954,7 @@ static bool listselbuf(void)
spawn(pager, g_tmpfpath, NULL, NULL, F_CLI); spawn(pager, g_tmpfpath, NULL, NULL, F_CLI);
unlink(g_tmpfpath); unlink(g_tmpfpath);
selbufpos = oldpos;
return TRUE; return TRUE;
} }
@ -3435,8 +3442,8 @@ static void show_help(const char *path)
"1FILES\n" "1FILES\n"
"b^O Open with... n Create new/link\n" "b^O Open with... n Create new/link\n"
"cD File details ^R F2 Rename/duplicate\n" "cD File details ^R F2 Rename/duplicate\n"
"3Space ^J/a Select entry/all r Batch rename\n" "3Space ^J/a Sel toggle/all r Batch rename\n"
"9m ^K Sel range, clear M Show sel buf\n" "9m ^K Sel range, clear M List selection\n"
"cP Copy selection K Edit, flush sel\n" "cP Copy selection K Edit, flush sel\n"
"cV Move selection w Copy/move sel as\n" "cV Move selection w Copy/move sel as\n"
"cX Del selection ^X Del entry\n" "cX Del selection ^X Del entry\n"
@ -4841,7 +4848,7 @@ nochange:
} }
continue; continue;
case SEL_SELLIST: case SEL_SELLIST:
if (listselbuf() || listselfile()) { if (listselbuf(path, newpath) || listselfile()) {
if (cfg.filtermode) if (cfg.filtermode)
presel = FILTER; presel = FILTER;
break; break;