Fix ecn (and VR) when no custom theme was set in .rc ##cons

This commit is contained in:
pancake 2021-01-03 10:15:00 +01:00 committed by GitHub
parent ef4c9b603d
commit 020c3056d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View File

@ -99,6 +99,10 @@ static bool nextpal_item(RCore *core, int mode, const char *file, int ctr) {
// TODO: move logic here
break;
case 'n': // next
if (curtheme && !strcmp (curtheme, "default")) {
curtheme = r_str_dup (curtheme, fn);
getNext = false;
}
if (getNext) {
curtheme = r_str_dup (curtheme, fn);
getNext = false;
@ -209,6 +213,7 @@ static void nextpal(RCore *core, int mode) {
// spaguetti!
if (home) {
files = r_sys_dir (home);
r_list_sort (files, (RListComparator)strcmp);
r_list_foreach (files, iter, fn) {
if (*fn && *fn != '.') {
if (mode == 'p') {
@ -248,6 +253,7 @@ static void nextpal(RCore *core, int mode) {
path = r_str_r2_prefix (R2_THEMES R_SYS_DIR);
if (path) {
files = r_sys_dir (path);
r_list_sort (files, (RListComparator)strcmp);
r_list_foreach (files, iter, fn) {
if (*fn && *fn != '.') {
if (mode == 'p') {
@ -266,7 +272,7 @@ static void nextpal(RCore *core, int mode) {
curtheme = strdup (fn);
goto done;
}
} else {
} else { // next
if (!nextpal_item (core, mode, fn, ctr++)) {
goto done;
}
@ -415,7 +421,7 @@ static int cmd_eval(void *data, const char *input) {
const char *th;
r_list_foreach (themes_list, th_iter, th) {
if (curtheme && !strcmp (curtheme, th)) {
r_cons_printf ("> %s\n", th);
r_cons_printf ("- %s\n", th);
} else {
r_cons_printf (" %s\n", th);
}

View File

@ -1,3 +1,28 @@
NAME=eco-ecn
FILE=-
CMDS=<<EOF
eco~^-
ecn
eco~^-
ecn
eco~^-
ecp
eco~^-
ecp
eco~^-
ecp
eco~^-
EOF
EXPECT=<<EOF
- default
- basic
- behelit
- basic
- ayu
- ayu
EOF
RUN
NAME=ec* fgbg
FILE=-
CMDS=<<EOF