Skip to content

Commit

Permalink
Fix patch failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Sep 20, 2023
1 parent 9c7c728 commit c789588
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions patches/gitstatus/mainline.diff
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ index 83ecdb90..4397944a 100644

while ((opt = (env_opts_id > 0
? env_opts[--env_opts_id]
- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
switch (opt) {
#ifndef NOFIFO
case 'a':
Expand Down
4 changes: 2 additions & 2 deletions patches/gitstatus/namefirst.diff
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ index 88538787..d4af7c43 100644

while ((opt = (env_opts_id > 0
? env_opts[--env_opts_id]
- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) {
- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVxh"))) != -1) {
switch (opt) {
#ifndef NOFIFO
case 'a':
Expand Down
40 changes: 21 additions & 19 deletions patches/restorepreview/mainline.diff
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ index b10143a4..76d6bc5b 100644
uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */
uint_t uidgid : 1; /* Show owner and group info */
uint_t usebsdtar : 1; /* Use bsdtar as default archive utility */
uint_t xprompt : 1; /* Use native prompt instead of readline prompt */
- uint_t reserved : 4; /* Adjust when adding/removing a field */
+ uint_t previewer : 1; /* Run state of previewer */
uint_t reserved : 5; /* Adjust when adding/removing a field */
+ uint_t reserved : 3; /* Adjust when adding/removing a field */
} runstate;

@@ -500,6 +501,9 @@ static char g_tmpfpath[TMP_LEN_MAX] __attribute__ ((aligned));
/* Buffer to store plugins control pipe location */
static char g_pipepath[TMP_LEN_MAX] __attribute__ ((aligned));

+/* Buffer to store preview plugins control pipe location */
+static char g_ppipepath[TMP_LEN_MAX] __attribute__ ((aligned));
+
/* Non-persistent runtime states */
static runstate g_state;

@@ -676,12 +680,13 @@ static const char * const messages[] = {
#define NNN_FCOLORS 5
#define NNNLVL 6
Expand All @@ -45,7 +47,7 @@ index b10143a4..76d6bc5b 100644
+#define NNN_ORDER 12
+#define NNN_HELP 13 /* strings end here */
+#define NNN_TRASH 14 /* flags begin here */

static const char * const env_cfg[] = {
"NNN_OPTS",
@@ -692,6 +697,7 @@ static const char * const env_cfg[] = {
Expand All @@ -63,7 +65,7 @@ index b10143a4..76d6bc5b 100644
-static void notify_fifo(bool force);
+static void notify_fifo(bool force, bool closepreview);
#endif

/* Functions */
@@ -3022,7 +3028,7 @@ try_quit:
} else {
Expand All @@ -75,13 +77,13 @@ index b10143a4..76d6bc5b 100644
escaped = TRUE;
settimeout();
@@ -5120,15 +5126,20 @@ static void run_cmd_as_plugin(const char *file, char *runfile, uchar_t flags)

static bool plctrl_init(void)
{
- size_t len;
+ size_t len, lenbuf;
+ pid_t pid = getpid();

/* g_tmpfpath is used to generate tmp file names */
g_tmpfpath[tmpfplen - 1] = '\0';
- len = xstrsncpy(g_pipepath, g_tmpfpath, TMP_LEN_MAX);
Expand All @@ -96,13 +98,13 @@ index b10143a4..76d6bc5b 100644
+ xstrsncpy(g_ppipepath + len - 1, xitoa(pid), TMP_LEN_MAX - len);
setenv(env_cfg[NNN_PIPE], g_pipepath, TRUE);
+ setenv(env_cfg[NNN_PPIPE], g_ppipepath, TRUE);

return EXIT_SUCCESS;
}
@@ -5157,6 +5168,21 @@ static ssize_t read_nointr(int fd, void *buf, size_t count)
return len;
}

+void *previewpipe(void *arg __attribute__ ((unused)))
+{
+ int fd, buf;
Expand All @@ -123,7 +125,7 @@ index b10143a4..76d6bc5b 100644
char ctx, *nextpath = NULL;
@@ -5841,7 +5867,7 @@ static void populate(char *path, char *lastname)
}

#ifndef NOFIFO
-static void notify_fifo(bool force)
+static void notify_fifo(bool force, bool closepreview)
Expand All @@ -133,15 +135,15 @@ index b10143a4..76d6bc5b 100644
@@ -5857,6 +5883,12 @@ static void notify_fifo(bool force)
}
}

+ if (closepreview) {
+ if (write(fifofd, "close\n", 6) != 6)
+ xerror();
+ return;
+ }
+
static struct entry lastentry;

if (!force && !memcmp(&lastentry, &pdents[cur], sizeof(struct entry))) // NOLINT
@@ -5889,7 +5921,7 @@ static void send_to_explorer(int *presel)
if (fd > 1)
Expand All @@ -151,16 +153,16 @@ index b10143a4..76d6bc5b 100644
+ notify_fifo(TRUE, FALSE); /* Send opened path to NNN_FIFO */
}
#endif

@@ -5922,7 +5954,7 @@ static void move_cursor(int target, int ignore_scrolloff)

#ifndef NOFIFO
if (!g_state.fifomode)
- notify_fifo(FALSE); /* Send hovered path to NNN_FIFO */
+ notify_fifo(FALSE, FALSE); /* Send hovered path to NNN_FIFO */
#endif
}

@@ -6539,7 +6571,7 @@ static bool browse(char *ipath, const char *session, int pkey)
pEntry pent;
enum action sel;
Expand Down Expand Up @@ -220,7 +222,7 @@ index b10143a4..76d6bc5b 100644
@@ -7667,6 +7713,12 @@ nochange:
goto nochange;
}

+ if (xstrcmp(tmp, "preview-tui") == 0) {
+ previewkey = r;
+ pthread_t tid;
Expand All @@ -241,7 +243,7 @@ index b10143a4..76d6bc5b 100644
+ pkey = previewkey;
+ goto run_plugin;
+ }

/* Continue in type-to-nav mode, if enabled */
if (cfg.filtermode)
@@ -8263,8 +8321,10 @@ static void cleanup(void)
Expand All @@ -257,7 +259,7 @@ index b10143a4..76d6bc5b 100644
disabledbg();
#endif
@@ -8769,7 +8829,7 @@ int main(int argc, char *argv[])

#ifndef NOFIFO
if (!g_state.fifomode)
- notify_fifo(FALSE);
Expand Down

0 comments on commit c789588

Please sign in to comment.