]> Sergey Matveev's repositories - nnn.git/commitdiff
One notify FIFO mode at a time
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 20 Jun 2021 16:11:16 +0000 (21:41 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 20 Jun 2021 16:12:44 +0000 (21:42 +0530)
nnn.1
src/nnn.c

diff --git a/nnn.1 b/nnn.1
index ce813e6d6db3f6a1a28dfed2057b5bc94170be97..f6714c8d2e228cbef9bb4bdf01cf92c6eb1210fd 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -76,7 +76,7 @@ supports the following options:
 .Pp
 .Fl "F val"
         fifo notification mode
-        0: notify as previewer, 1: notify as explorer, 2: both
+        0: notify as previewer, 1: notify as explorer
 .Pp
 .Fl g
         use regex filters instead of substring match
index 656f9fc1a1d3a88073292675fa745d508ad3e65d..33b33b989555460d133395851a7c0fa265450262 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -326,7 +326,7 @@ typedef struct {
        uint_t dircolor   : 1;  /* Current status of dir color */
        uint_t dirctx     : 1;  /* Show dirs in context color */
        uint_t duinit     : 1;  /* Initialize disk usage */
-       uint_t fifobits   : 2;  /* FIFO notify mode: b00: previewer, b01: explorer, b10: both */
+       uint_t fifomode   : 1;  /* FIFO notify mode: 0: preview, 1: explore */
        uint_t forcequit  : 1;  /* Do not prompt on quit */
        uint_t initfile   : 1;  /* Positional arg is a file */
        uint_t interrupt  : 1;  /* Program received an interrupt */
@@ -343,7 +343,7 @@ typedef struct {
        uint_t stayonsel  : 1;  /* Disable auto-proceed on select */
        uint_t trash      : 2;  /* Use trash to delete files 1: trash-cli, 2: gio trash */
        uint_t uidgid     : 1;  /* Show owner and group info */
-       uint_t reserved   : 6;  /* Adjust when adding/removing a field */
+       uint_t reserved   : 7;  /* Adjust when adding/removing a field */
 } runstate;
 
 /* Contexts or workspaces */
@@ -2760,7 +2760,7 @@ try_quit:
                                c = CONTROL('Q');
                        } else {
 #ifndef NOFIFO
-                               if (!(g_state.fifobits & 1))
+                               if (!g_state.fifomode)
                                        notify_fifo(TRUE); /* Send hovered path to NNN_FIFO */
 #endif
                                escaped = TRUE;
@@ -5481,7 +5481,7 @@ static void move_cursor(int target, int ignore_scrolloff)
        curscroll = MAX(curscroll, MAX(cur - (onscreen - 1), 0));
 
 #ifndef NOFIFO
-       if (!(g_state.fifobits & 1))
+       if (!g_state.fifomode)
                notify_fifo(FALSE); /* Send hovered path to NNN_FIFO */
 #endif
 }
@@ -6347,7 +6347,7 @@ nochange:
                                if (r != cur)
                                        move_cursor(r, 1);
 #ifndef NOFIFO
-                               else if ((event.bstate == BUTTON1_PRESSED) && !(g_state.fifobits & 1))
+                               else if ((event.bstate == BUTTON1_PRESSED) && !g_state.fifomode)
                                        notify_fifo(TRUE); /* Send clicked path to NNN_FIFO */
 #endif
                                /* Handle right click selection */
@@ -6421,13 +6421,13 @@ nochange:
                                goto nochange;
                         }
 #ifndef NOFIFO
-                       if (g_state.fifobits && sel == SEL_OPEN) {
+                       if (g_state.fifomode && (sel == SEL_OPEN)) {
                                notify_fifo(TRUE); /* Send opened path to NNN_FIFO */
                                goto nochange;
                        }
 #endif
                        /* If opened as vim plugin and Enter/^M pressed, pick */
-                       if (g_state.picker && sel == SEL_OPEN) {
+                       if (g_state.picker && (sel == SEL_OPEN)) {
                                appendfpath(newpath, mkpath(path, pent->name, newpath));
                                writesel(pselbuf, selbufpos - 1);
                                return EXIT_SUCCESS;
@@ -7635,7 +7635,7 @@ static void usage(void)
                " -f      use readline history file\n"
 #endif
 #ifndef NOFIFO
-               " -F val  fifo mode [0:preview 1:explore 2:both]\n"
+               " -F val  fifo mode [0:preview 1:explore]\n"
 #endif
                " -g      regex filters\n"
                " -H      show hidden files\n"
@@ -7861,9 +7861,9 @@ int main(int argc, char *argv[])
                case 'F':
                        if (env_opts_id < 0) {
                                fd = atoi(optarg);
-                               if ((fd < 0) || (fd > 2))
+                               if ((fd < 0) || (fd > 1))
                                        return EXIT_FAILURE;
-                               g_state.fifobits = fd;
+                               g_state.fifomode = fd;
                        }
                        break;
 #endif
@@ -8269,7 +8269,8 @@ int main(int argc, char *argv[])
 #endif
 
 #ifndef NOFIFO
-       notify_fifo(FALSE);
+       if (!g_state.fifomode)
+               notify_fifo(FALSE);
        if (fifofd != -1)
                close(fifofd);
 #endif