Remove option to disable color

This commit is contained in:
Arun Prakash Jana 2019-02-28 20:13:37 +05:30
parent 0522a426c0
commit 7d36f54d75
No known key found for this signature in database
GPG key ID: A75979F35C080412
6 changed files with 26 additions and 45 deletions

View file

@ -219,7 +219,6 @@ positional args:
optional args: optional args:
-b key open bookmark key -b key open bookmark key
-C disable directory color
-e use exiftool for media info -e use exiftool for media info
-i nav-as-you-type mode -i nav-as-you-type mode
-l light mode -l light mode

4
nnn.1
View file

@ -7,7 +7,6 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Ar -b key .Op Ar -b key
.Op Ar -C
.Op Ar -e .Op Ar -e
.Op Ar -i .Op Ar -i
.Op Ar -l .Op Ar -l
@ -174,9 +173,6 @@ supports the following options:
.Fl "b key" .Fl "b key"
specify bookmark key to open specify bookmark key to open
.Pp .Pp
.Fl C
disable directory color
.Pp
.Fl e .Fl e
use exiftool instead of mediainfo use exiftool instead of mediainfo
.Pp .Pp

View file

@ -12,7 +12,6 @@ _nnn () {
local -a opts opts_with_args local -a opts opts_with_args
opts=( opts=(
-b -b
-C
-e -e
-h -h
-i -i

View file

@ -6,7 +6,6 @@
# #
complete -c nnn -s b -r -d 'bookmark key to open' complete -c nnn -s b -r -d 'bookmark key to open'
complete -c nnn -s C -d 'disable directory color'
complete -c nnn -s e -d 'use exiftool instead of mediainfo' complete -c nnn -s e -d 'use exiftool instead of mediainfo'
complete -c nnn -s h -d 'show this help and exit' complete -c nnn -s h -d 'show this help and exit'
complete -c nnn -s i -d 'start in navigate-as-you-type mode' complete -c nnn -s i -d 'start in navigate-as-you-type mode'

View file

@ -10,7 +10,6 @@ setopt localoptions noshwordsplit noksharrays
local -a args local -a args
args=( args=(
'(-b)-b[bookmark key to open]:key char' '(-b)-b[bookmark key to open]:key char'
'(-C)-C[disable directory color]'
'(-e)-e[use exiftool instead of mediainfo]' '(-e)-e[use exiftool instead of mediainfo]'
'(-h)-h[show this help and exit]' '(-h)-h[show this help and exit]'
'(-i)-i[start in navigate-as-you-type mode]' '(-i)-i[start in navigate-as-you-type mode]'

View file

@ -281,11 +281,10 @@ typedef struct {
uint copymode : 1; /* Set when copying files */ uint copymode : 1; /* Set when copying files */
uint autoselect : 1; /* Auto-select dir in nav-as-you-type mode */ uint autoselect : 1; /* Auto-select dir in nav-as-you-type mode */
uint showdetail : 1; /* Clear to show fewer file info */ uint showdetail : 1; /* Clear to show fewer file info */
uint showcolor : 1; /* Set to show dirs in blue */
uint dircolor : 1; /* Current status of dir color */ uint dircolor : 1; /* Current status of dir color */
uint metaviewer : 1; /* Index of metadata viewer in utils[] */ uint metaviewer : 1; /* Index of metadata viewer in utils[] */
uint ctxactive : 1; /* Context active or not */ uint ctxactive : 1; /* Context active or not */
uint reserved : 7; uint reserved : 8;
/* The following settings are global */ /* The following settings are global */
uint curctx : 2; /* Current context number */ uint curctx : 2; /* Current context number */
uint picker : 1; /* Write selection to user-specified file */ uint picker : 1; /* Write selection to user-specified file */
@ -311,7 +310,7 @@ typedef struct {
/* GLOBALS */ /* GLOBALS */
/* Configuration, contexts */ /* Configuration, contexts */
static settings cfg = {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}; static settings cfg = {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0};
static context g_ctx[CTX_MAX] __attribute__ ((aligned)); static context g_ctx[CTX_MAX] __attribute__ ((aligned));
static struct entry *dents; static struct entry *dents;
@ -936,12 +935,13 @@ static bool initcurses(void)
curs_set(FALSE); /* Hide cursor */ curs_set(FALSE); /* Hide cursor */
start_color(); start_color();
use_default_colors(); use_default_colors();
if (cfg.showcolor) {
/* Initialize default colors */
init_pair(1, g_ctx[0].color, -1); init_pair(1, g_ctx[0].color, -1);
init_pair(2, g_ctx[1].color, -1); init_pair(2, g_ctx[1].color, -1);
init_pair(3, g_ctx[2].color, -1); init_pair(3, g_ctx[2].color, -1);
init_pair(4, g_ctx[3].color, -1); init_pair(4, g_ctx[3].color, -1);
}
settimeout(); /* One second */ settimeout(); /* One second */
set_escdelay(25); set_escdelay(25);
return TRUE; return TRUE;
@ -2751,20 +2751,14 @@ static void redraw(char *path)
if (!g_ctx[i].c_cfg.ctxactive) if (!g_ctx[i].c_cfg.ctxactive)
printw("%d ", i + 1); printw("%d ", i + 1);
else if (cfg.curctx != i) { else if (cfg.curctx != i) {
if (cfg.showcolor)
attrs = COLOR_PAIR(i + 1) | A_BOLD | A_UNDERLINE; attrs = COLOR_PAIR(i + 1) | A_BOLD | A_UNDERLINE;
else
attrs = A_UNDERLINE;
attron(attrs); attron(attrs);
printw("%d", i + 1); printw("%d", i + 1);
attroff(attrs); attroff(attrs);
printw(" "); printw(" ");
} else { } else {
/* Print current context in reverse */ /* Print current context in reverse */
if (cfg.showcolor)
attrs = COLOR_PAIR(i + 1) | A_BOLD | A_REVERSE; attrs = COLOR_PAIR(i + 1) | A_BOLD | A_REVERSE;
else
attrs = A_REVERSE;
attron(attrs); attron(attrs);
printw("%d", i + 1); printw("%d", i + 1);
attroff(attrs); attroff(attrs);
@ -2793,7 +2787,7 @@ static void redraw(char *path)
else else
ncols -= 5; ncols -= 5;
if (!cfg.wild && cfg.showcolor) { if (!cfg.wild) {
attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
cfg.dircolor = 1; cfg.dircolor = 1;
} }
@ -4004,7 +3998,7 @@ int main(int argc, char *argv[])
char *ipath = NULL; char *ipath = NULL;
int opt; int opt;
while ((opt = getopt(argc, argv, "Slib:Cenp:svwh")) != -1) { while ((opt = getopt(argc, argv, "Slib:enp:svwh")) != -1) {
switch (opt) { switch (opt) {
case 'S': case 'S':
cfg.blkorder = 1; cfg.blkorder = 1;
@ -4021,9 +4015,6 @@ int main(int argc, char *argv[])
case 'b': case 'b':
ipath = optarg; ipath = optarg;
break; break;
case 'C':
cfg.showcolor = 0;
break;
case 'e': case 'e':
cfg.metaviewer = EXIFTOOL; cfg.metaviewer = EXIFTOOL;
break; break;
@ -4069,7 +4060,6 @@ int main(int argc, char *argv[])
} }
/* Get the context colors; copier used as tmp var */ /* Get the context colors; copier used as tmp var */
if (cfg.showcolor) {
copier = xgetenv(env_cfg[NNN_CONTEXT_COLORS], "4444"); copier = xgetenv(env_cfg[NNN_CONTEXT_COLORS], "4444");
opt = 0; opt = 0;
while (opt < CTX_MAX) { while (opt < CTX_MAX) {
@ -4086,7 +4076,6 @@ int main(int argc, char *argv[])
++opt; ++opt;
} }
}
/* Parse bookmarks string */ /* Parse bookmarks string */
if (!parsebmstr()) { if (!parsebmstr()) {