commit 852d24eba249e0d479d642b9e58dd54c2ab94eaa
Author: rani <clagv.randomgames@gmail.com>
Date: Mon Jun 27 16:47:49 2022 +0000
diff --git a/include/io.h b/include/io.h
index 5cdd483..4d20757 100644
--- a/include/io.h
+++ b/include/io.h
@@ -328 +3210 @@ enum colors {
CUSTOM_MEDIA = 19,
CUSTOM_ARCHIVE = 20,
- RED = 21,
- WHITE = 22,
+ RED = 21,
+ WHITE = 22,
+ YELLOW = 23,
+ MAGENTA = 24,
};
enum keys {
@@ -546 +567 @@ char * curses_getline(char *);
void unmark_all(void);
void mark_all(void);
void set_color(void);
+void print_mode(struct dir_entry_t *);
extern bool print_path;
diff --git a/src/io.c b/src/io.c
index dee802c..0aea581 100644
--- a/src/io.c
+++ b/src/io.c
@@ -856 +858 @@ void set_color(void) {
init_pair(RED, COLOR_RED, COLOR_BLACK);
init_pair(WHITE, COLOR_WHITE, COLOR_BLACK);
+ init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK);
+ init_pair(MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
} else {
// COLOR_ARCHIVE is highest enum value
for (int i = 1; i <= COLOR_ARCHIVE; i++) {
@@ -936 +958 @@ void set_color(void) {
init_pair(RED, COLOR_WHITE, COLOR_BLACK);
init_pair(WHITE, COLOR_WHITE, COLOR_BLACK);
+ init_pair(YELLOW, COLOR_WHITE, COLOR_BLACK);
+ init_pair(MAGENTA, COLOR_WHITE, COLOR_BLACK);
}
}
@@ -1929 +19610 @@ void curses_write_file(struct dir_entry_t * dir_entry, bool highlight) {
if (dir_entry->marked) printw("%c ", '-');
if (p_long) {
- printw("%s %s %s %-4d%2s %s ",
- smode, owner, group,
- dir_entry->size, size, time);
+ print_mode(dir_entry);
+ printw(" %s %s %-4d%2s %s ",
+ owner, group, dir_entry->size,
+ size, time);
free(smode);
}
#if ICONS
@@ -2086 +21326 @@ void curses_write_file(struct dir_entry_t * dir_entry, bool highlight) {
}
+void print_mode(struct dir_entry_t * f) {
+ enum colors m_colors[127] = {
+ ['s'] = YELLOW, ['d'] = COLOR_DIR, ['.'] = WHITE,
+ ['r'] = RED, ['w'] = MAGENTA, ['x'] = COLOR_EXEC,
+ ['S'] = YELLOW, ['t'] = RED, ['T'] = RED,
+ ['-'] = WHITE,
+ };
+
+ char * mode = mode_to_s(f);
+ for (char * c = mode; *c; c++) {
+ int cp = m_colors[(int)*c];
+ if (!cp) cp = WHITE;
+ attron(COLOR_PAIR(cp));
+ addch(*c);
+ attroff(COLOR_PAIR(cp));
+ }
+ free(mode);
+}
+
+
char * prompt(char * t, char ** args) {
int sub_cols = 30;
int sub_rows = sub_cols / 2;