commit 7cc31fe6bb2d08c3ca0a273acae82e50850617e0
parent 526e7e5419c507620d09376f4b61bf5f5db4adfd
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sat, 8 Nov 2025 08:54:49 +0530
Enable 8 contexts by default
Diffstat:
5 files changed, 5 insertions(+), 24 deletions(-)
diff --git a/Makefile b/Makefile
@@ -18,7 +18,6 @@ O_NOLC := 0 # no locale support
O_NOMOUSE := 0 # no mouse support
O_NOBATCH := 0 # no built-in batch renamer
O_NOFIFO := 0 # no FIFO previewer support
-O_CTX8 := 0 # enable 8 contexts
O_ICONS := 0 # support icons-in-terminal
O_NERD := 0 # support icons-nerdfont
O_EMOJI := 0 # support emoji
@@ -92,10 +91,6 @@ ifeq ($(strip $(O_NOFIFO)),1)
CPPFLAGS += -DNOFIFO
endif
-ifeq ($(strip $(O_CTX8)),1)
- CPPFLAGS += -DCTX8
-endif
-
ifeq ($(strip $(O_ICONS)),1)
ICONS_INCLUDE = icons-generated-icons-in-term.h
CPPFLAGS += -DICONS_IN_TERM -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
diff --git a/misc/haiku/Makefile b/misc/haiku/Makefile
@@ -16,7 +16,6 @@ O_NOLC := 0 # no locale support
O_NOMOUSE := 0 # no mouse support
O_NOBATCH := 0 # no built-in batch renamer
O_NOFIFO := 0 # no FIFO previewer support
-O_CTX8 := 0 # enable 8 contexts
O_ICONS := 0 # support icons-in-terminal
O_NERD := 0 # support icons-nerdfont
O_QSORT := 0 # use Alexey Tourbin's QSORT implementation
@@ -87,10 +86,6 @@ ifeq ($(strip $(O_NOFIFO)),1)
CPPFLAGS += -DNOFIFO
endif
-ifeq ($(strip $(O_CTX8)),1)
- CPPFLAGS += -DCTX8
-endif
-
ifeq ($(strip $(O_ICONS)),1)
CPPFLAGS += -DICONS
endif
diff --git a/nnn.1 b/nnn.1
@@ -183,7 +183,7 @@ uses \fBxdg-open\fR (on Linux), \fBopen(1)\fR (on macOS), \fBcygstart\fR on
(Cygwin) and \fBopen\fR on (Haiku) as the desktop opener. It's also possible
to specify a custom opener. Refer to the \fBENVIRONMENT\fR section.
.Sh CONTEXTS
-Open multiple locations with 4 contexts. The status is shown in the top left
+Open multiple locations with 8 contexts. The status is shown in the top left
corner:
.Pp
- the current context is in reverse video
@@ -541,14 +541,14 @@ separated by \fB;\fR:
.Bd -literal
# 8 color numbers:
# 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
- export NNN_COLORS='1234'
+ export NNN_COLORS='12341234'
# xterm 256 color numbers (converted to hex, 2 symbols per context):
# see https://user-images.githubusercontent.com/1482942/93023823-46a6ba80-f5e1-11ea-9ea3-6a3c757704f4.png
- export NNN_COLORS='#0a1b2c3d'
+ export NNN_COLORS='#0a1b2c3d0a1b2c3d'
# both (256 followed by 8 as fallback, separated by ';')
- export NNN_COLORS='#0a1b2c3d;1234'
+ export NNN_COLORS='#0a1b2c3d0a1b2c3d;12341234'
NOTE: If only 256 colors are specified and the terminal doesn't support, default is used.
.Ed
diff --git a/src/nnn.c b/src/nnn.c
@@ -220,11 +220,8 @@
#define DBLCLK_INTERVAL_NS (400000000)
#define XDELAY_INTERVAL_MS (350000) /* 350 ms delay */
-#ifndef CTX8
-#define CTX_MAX 4
-#else
+/* Use 8 contexts */
#define CTX_MAX 8
-#endif
#ifndef SED
/* BSDs or Solaris or SunOS */
@@ -7519,12 +7516,10 @@ 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;
diff --git a/src/nnn.h b/src/nnn.h
@@ -71,12 +71,10 @@ enum action {
SEL_CTX2,
SEL_CTX3,
SEL_CTX4,
-#ifdef CTX8
SEL_CTX5,
SEL_CTX6,
SEL_CTX7,
SEL_CTX8,
-#endif
SEL_MARK,
SEL_BMARK,
SEL_FLTR,
@@ -189,12 +187,10 @@ 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_MARK },
/* Create a bookmark */