]> Sergey Matveev's repositories - nnn.git/commitdiff
Support make option O_CTX8 for 8 contexts
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 30 May 2020 01:29:45 +0000 (06:59 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 30 May 2020 01:31:34 +0000 (07:01 +0530)
Note that this is not compatible with 4 contexts.

Makefile
misc/haiku/Makefile
src/nnn.c
src/nnn.h

index 830b36a39b42f9a364b0b11d7346bacf4a8264fa..1a2e6e77f489d02b338bb46ac207b71709710a75 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,10 @@ ifeq ($(O_NOFIFO),1)
        CPPFLAGS += -DNOFIFO
 endif
 
+ifeq ($(O_CTX8),1)
+       CPPFLAGS += -DCTX8
+endif
+
 ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
        CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
        LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs   ncursesw)
index 02d22a0c43a9224b982717abdf0aef8964c477b7..7c534e714088349983fba533bedde67ffb9021cb 100644 (file)
@@ -52,6 +52,10 @@ ifeq ($(O_NOMOUSE),1)
        CPPFLAGS += -DNOMOUSE
 endif
 
+ifeq ($(O_CTX8),1)
+       CPPFLAGS += -DCTX8
+endif
+
 ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
        CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
        LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs   ncursesw)
index d0ad8f13aef4b2e1f9c6df4843acc048d3dbe040..771d2b6553ae38ead58a5e78c8eb02f5c4d82e68 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
 #define EXEC_ARGS_MAX 8
 #define LIST_FILES_MAX (1 << 16)
 #define SCROLLOFF 3
+
+#ifndef CTX8
 #define CTX_MAX 4
+#else
+#define CTX_MAX 8
+#endif
+
 #define MIN_DISPLAY_COLS ((CTX_MAX * 2) + 2) /* Two chars for [ and ] */
 #define LONG_SIZE sizeof(ulong)
 #define ARCHIVE_CMD_LEN 16
@@ -5738,6 +5744,12 @@ nochange:
                case SEL_CTX2: // fallthrough
                case SEL_CTX3: // fallthrough
                case SEL_CTX4:
+#ifdef CTX8
+               case SEL_CTX5:
+               case SEL_CTX6:
+               case SEL_CTX7:
+               case SEL_CTX8:
+#endif
                        r = handle_context_switch(sel);
                        if (r < 0)
                                continue;
index e932624b04261c9e7557862d7e7da9cf68b2f8a7..e6ee5e86d35898af3c4bc39665e1baac5d419c69 100644 (file)
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -60,6 +60,12 @@ enum action {
        SEL_CTX2,
        SEL_CTX3,
        SEL_CTX4,
+#ifdef CTX8
+       SEL_CTX5,
+       SEL_CTX6,
+       SEL_CTX7,
+       SEL_CTX8,
+#endif
        SEL_PIN,
        SEL_FLTR,
        SEL_MFLTR,
@@ -165,6 +171,12 @@ static struct key bindings[] = {
        { '2',            SEL_CTX2 },
        { '3',            SEL_CTX3 },
        { '4',            SEL_CTX4 },
+#ifdef CTX8
+       { '5',            SEL_CTX5 },
+       { '6',            SEL_CTX6 },
+       { '7',            SEL_CTX7 },
+       { '8',            SEL_CTX8 },
+#endif
        /* Mark a path to visit later */
        { ',',            SEL_PIN },
        /* Filter */