mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Fix #889: clear selection if plugin doesn't send data
This commit is contained in:
parent
c825a9e541
commit
5f0b3b74d0
|
@ -215,6 +215,8 @@ For convenience, we provided a helper script named `.nnn-plugin-helper` and a fu
|
||||||
If a context is not provided, it is asked for explicitly. To skip this and choose the current context, set the `CUR_CTX` variable in `.nnn-plugin-helper` (or in the specific plugin after sourcing `.nnn-plugin-helper`) to 1.
|
If a context is not provided, it is asked for explicitly. To skip this and choose the current context, set the `CUR_CTX` variable in `.nnn-plugin-helper` (or in the specific plugin after sourcing `.nnn-plugin-helper`) to 1.
|
||||||
Usage examples can be found in the Examples section below.
|
Usage examples can be found in the Examples section below.
|
||||||
|
|
||||||
|
If a plugin doesn't send any data back to `nnn` and there's a selection, the selection is cleared.
|
||||||
|
|
||||||
#### Get notified on file hover
|
#### Get notified on file hover
|
||||||
|
|
||||||
If `NNN_FIFO` is set, `nnn` will open it and write every hovered files. This can be used in plugins and external scripts, e.g. to implement file previews.
|
If `NNN_FIFO` is set, `nnn` will open it and write every hovered files. This can be used in plugins and external scripts, e.g. to implement file previews.
|
||||||
|
|
|
@ -4754,8 +4754,11 @@ static void readpipe(int fd, char **path, char **lastname, char **lastdir)
|
||||||
char ctx, *nextpath = NULL;
|
char ctx, *nextpath = NULL;
|
||||||
ssize_t len = read_nointr(fd, g_buf, 1);
|
ssize_t len = read_nointr(fd, g_buf, 1);
|
||||||
|
|
||||||
if (len != 1)
|
if (len != 1) {
|
||||||
|
if (selbufpos)
|
||||||
|
clearselection();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_buf[0] == '+')
|
if (g_buf[0] == '+')
|
||||||
ctx = (char)(get_free_ctx() + 1);
|
ctx = (char)(get_free_ctx() + 1);
|
||||||
|
@ -4786,7 +4789,8 @@ static void readpipe(int fd, char **path, char **lastname, char **lastdir)
|
||||||
rmlistpath();
|
rmlistpath();
|
||||||
|
|
||||||
nextpath = load_input(fd, *path);
|
nextpath = load_input(fd, *path);
|
||||||
}
|
} else if (selbufpos)
|
||||||
|
clearselection();
|
||||||
|
|
||||||
if (nextpath) {
|
if (nextpath) {
|
||||||
if (ctx == 0 || ctx == cfg.curctx + 1) { /* Same context */
|
if (ctx == 0 || ctx == cfg.curctx + 1) { /* Same context */
|
||||||
|
|
Loading…
Reference in a new issue