]> Sergey Matveev's repositories - nnn.git/commitdiff
Revert "Close previewer when opening file (#1171)"
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 22 Sep 2021 00:16:45 +0000 (05:46 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 22 Sep 2021 00:16:45 +0000 (05:46 +0530)
This reverts commit 532532704e72156aff140a07f8d7768d596eec02.

plugins/preview-tabbed
plugins/preview-tui
src/nnn.c

index 74f6ec5e3bb0ddc7f25432a84ace2ab4b514d870..a4921786b91299ccc992818142ae4993920193ff 100755 (executable)
@@ -133,10 +133,6 @@ previewer_loop () {
             continue
         fi
 
-        if [ "$FILE" = "close" ] ; then
-            break
-        fi
-
         kill_viewer
 
         MIME="$(file -bL --mime-type "$FILE")"
index f9b8236bbc4dc5ec4101d4fb91f45ae95e5b37a3..b6788fc40e702214d275c6dc231e32b6b38a66bd 100755 (executable)
@@ -389,7 +389,6 @@ preview_fifo() {
         if [ -n "$selection" ]; then
             kill "$(cat "$PREVIEWPID")"
             [ -p "$FIFO_UEBERZUG" ] && ueberzug_remove
-            [ "$selection" = "close" ] && break
             preview_file "$selection"
             printf "%s" "$selection" > "$CURSEL"
         fi
index 42768d9adbdb4ee30ab2dbe882d1480b48c13ebd..44f297f475b0fa9fa69351453ae465e3410ffdbe 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -846,7 +846,7 @@ static char *load_input(int fd, const char *path);
 static int set_sort_flags(int r);
 static void statusbar(char *path);
 #ifndef NOFIFO
-static void notify_fifo(bool force, bool closepreview);
+static void notify_fifo(bool force);
 #endif
 
 /* Functions */
@@ -3045,7 +3045,7 @@ try_quit:
                        } else {
 #ifndef NOFIFO
                                if (!g_state.fifomode)
-                                       notify_fifo(TRUE, FALSE); /* Send hovered path to NNN_FIFO */
+                                       notify_fifo(TRUE); /* Send hovered path to NNN_FIFO */
 #endif
                                escaped = TRUE;
                                settimeout();
@@ -5787,7 +5787,7 @@ static void populate(char *path, char *lastname)
 }
 
 #ifndef NOFIFO
-static void notify_fifo(bool force, bool closepreview)
+static void notify_fifo(bool force)
 {
        if (!fifopath)
                return;
@@ -5803,12 +5803,6 @@ static void notify_fifo(bool force, bool closepreview)
                }
        }
 
-       if (closepreview) {
-               if (write(fifofd, "close\n", 6) != 6)
-                       xerror();
-               return;
-       }
-
        static struct entry lastentry;
 
        if (!force && !memcmp(&lastentry, &pdents[cur], sizeof(struct entry)))
@@ -5858,7 +5852,7 @@ static void move_cursor(int target, int ignore_scrolloff)
 
 #ifndef NOFIFO
        if (!g_state.fifomode)
-               notify_fifo(FALSE, FALSE); /* Send hovered path to NNN_FIFO */
+               notify_fifo(FALSE); /* Send hovered path to NNN_FIFO */
 #endif
 }
 
@@ -6741,7 +6735,7 @@ nochange:
                                        move_cursor(r, 1);
 #ifndef NOFIFO
                                else if ((event.bstate == BUTTON1_PRESSED) && !g_state.fifomode)
-                                       notify_fifo(TRUE, FALSE); /* Send clicked path to NNN_FIFO */
+                                       notify_fifo(TRUE); /* Send clicked path to NNN_FIFO */
 #endif
                                /* Handle right click selection */
                                if (event.bstate == BUTTON3_PRESSED) {
@@ -6814,7 +6808,7 @@ nochange:
                         }
 #ifndef NOFIFO
                        if (g_state.fifomode && (sel == SEL_OPEN)) {
-                               notify_fifo(TRUE, FALSE); /* Send opened path to NNN_FIFO */
+                               notify_fifo(TRUE); /* Send opened path to NNN_FIFO */
                                goto nochange;
                        }
 #endif
@@ -6896,9 +6890,6 @@ nochange:
                            && strstr(g_buf, "text")
 #endif
                        ) {
-#ifndef NOFIFO
-                               notify_fifo(FALSE, TRUE);
-#endif
                                spawn(editor, newpath, NULL, NULL, F_CLI);
                                if (cfg.filtermode) {
                                        presel = FILTER;
@@ -6951,9 +6942,6 @@ nochange:
                        }
 
                        /* Invoke desktop opener as last resort */
-#ifndef NOFIFO
-                       notify_fifo(FALSE, TRUE);
-#endif
                        spawn(opener, newpath, NULL, NULL, opener_flags);
 
                        /* Move cursor to the next entry if not the last entry */
@@ -7210,9 +7198,6 @@ nochange:
                                copycurname();
                                goto nochange;
                        case SEL_EDIT:
-#ifndef NOFIFO
-                               notify_fifo(FALSE, TRUE);
-#endif
                                spawn(editor, newpath, NULL, NULL, F_CLI);
                                continue;
                        default: /* SEL_LOCK */
@@ -8696,7 +8681,7 @@ int main(int argc, char *argv[])
 
 #ifndef NOFIFO
        if (!g_state.fifomode)
-               notify_fifo(FALSE, FALSE);
+               notify_fifo(FALSE);
        if (fifofd != -1)
                close(fifofd);
 #endif