Single loop coloring

This commit is contained in:
Arun Prakash Jana 2019-02-23 08:51:21 +05:30
parent 078c982f4e
commit 2ae1cca96a
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -4105,19 +4105,18 @@ int main(int argc, char *argv[])
if (cfg.showcolor) {
copier = xgetenv(env_cfg[NNN_CONTEXT_COLORS], "4444");
opt = 0;
while (*copier && opt < CTX_MAX) {
if (*copier < '0' || *copier > '7') {
fprintf(stderr, "invalid color code\n");
return 1;
}
while (opt < CTX_MAX) {
if (*copier) {
if (*copier < '0' || *copier > '7') {
fprintf(stderr, "invalid color code\n");
return 1;
}
g_ctx[opt].color = *copier - '0';
++copier;
++opt;
}
g_ctx[opt].color = *copier - '0';
++copier;
} else
g_ctx[opt].color = 4;
while (opt != CTX_MAX) {
g_ctx[opt].color = 4;
++opt;
}
}