Killed cons->truecolor in favor of cons->color
This commit is contained in:
parent
29158c3726
commit
5e097dbae1
|
@ -521,11 +521,10 @@ int main(int argc, char **argv, char **envp) {
|
|||
break;
|
||||
case '0':
|
||||
zerosep = true;
|
||||
//r_config_set (r.config, "scr.color", "false");
|
||||
/* implicit -q */
|
||||
r_config_set (r.config, "scr.interactive", "false");
|
||||
r_config_set (r.config, "scr.prompt", "false");
|
||||
r_config_set (r.config, "scr.color", "false");
|
||||
r_config_set_i (r.config, "scr.color", COLORS_DISABLED);
|
||||
quiet = true;
|
||||
break;
|
||||
case 'u':
|
||||
|
@ -1293,7 +1292,7 @@ int main(int argc, char **argv, char **envp) {
|
|||
#if UNCOLORIZE_NONTTY
|
||||
#if __UNIX__
|
||||
if (!r_cons_isatty ()) {
|
||||
r_config_set_i (r.config, "scr.color", 0);
|
||||
r_config_set_i (r.config, "scr.color", COLORS_DISABLED);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -816,8 +816,8 @@ int main(int argc, char **argv) {
|
|||
addr = "main";
|
||||
}
|
||||
/* should be in mode not in bool pdc */
|
||||
r_config_set (c->config, "scr.color", "false");
|
||||
r_config_set (c2->config, "scr.color", "false");
|
||||
r_config_set (c->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set (c2->config, "scr.color", COLORS_DISABLED);
|
||||
|
||||
ut64 addra = r_num_math (c->num, addr);
|
||||
bufa = (ut8 *) r_core_cmd_strf (c, "af;pdc @ 0x%08"PFMT64x, addra);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# r2 -qi all68k - > all68k.txt
|
||||
#
|
||||
|
||||
e scr.color=false
|
||||
e scr.color=0
|
||||
e asm.arch=m68k
|
||||
e asm.nbytes=16
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ Step through your seek history with the commands 'u' (undo) and 'U' (redo)
|
|||
Use hasher to calculate hashes of portion blocks of a file
|
||||
Use zoom.byte=entropy and press 'z' in visual mode to zoom out to see the entropy of the whole file
|
||||
Use 'zoom.byte=printable' in zoom mode ('z' in Visual mode) to find strings
|
||||
Set color to your screen with 'e scr.color=true'
|
||||
Add colors to your screen with 'e scr.color=X' where 1 is 16 colors, 2 is 256 colors and 3 is 16M colors
|
||||
Trace register changes while debugging with 'e trace.cmtregs=true'
|
||||
Move the comments to the right changing their margin with asm.cmt.margin
|
||||
Execute a command on the visual prompt with cmd.vprompt
|
||||
|
|
4
doc/hud
4
doc/hud
|
@ -6,7 +6,9 @@ analyze function af
|
|||
analyze preludes ap
|
||||
continue process execution dc;?i
|
||||
disable colors e scr.color=0
|
||||
enable colors e scr.color=1
|
||||
enable colors (ANSI 16) e scr.color=1
|
||||
enable colors (256) e scr.color=2
|
||||
enable colors (16M) e scr.color=3
|
||||
randomize colors ecr
|
||||
hide bytes in disassembly e asm.bytes=false
|
||||
show bytes in disassembly e asm.bytes=true
|
||||
|
|
|
@ -24,7 +24,7 @@ function runWebServer(r) {
|
|||
wwwroot = wwwroot.trim ();
|
||||
r.cmd ("e http.port", function(port) {
|
||||
port = +port.trim ();
|
||||
r.cmd ("e scr.color=false", function() {});
|
||||
r.cmd ("e scr.color=0", function() {});
|
||||
r.cmd ("e scr.interactive=false", function() {});
|
||||
r.cmd ("e scr.html=true", function(){});
|
||||
var app = express();
|
||||
|
|
|
@ -73,7 +73,7 @@ static inline void r_cons_write(const char *buf, int len) {
|
|||
|
||||
R_API RColor r_cons_color_random(ut8 alpha) {
|
||||
RColor rcolor;
|
||||
if (I.truecolor > 0) {
|
||||
if (I.color > COLORS_16) {
|
||||
rcolor.r = r_num_rand (0xff);
|
||||
rcolor.g = r_num_rand (0xff);
|
||||
rcolor.b = r_num_rand (0xff);
|
||||
|
@ -277,7 +277,7 @@ R_API RCons *r_cons_new() {
|
|||
I.event_interrupt = NULL;
|
||||
I.is_wine = -1;
|
||||
I.fps = 0;
|
||||
I.use_color = false;
|
||||
I.color = COLORS_DISABLED;
|
||||
I.blankline = true;
|
||||
I.teefile = NULL;
|
||||
I.fix_columns = 0;
|
||||
|
@ -325,7 +325,6 @@ R_API RCons *r_cons_new() {
|
|||
}
|
||||
#endif
|
||||
I.pager = NULL; /* no pager by default */
|
||||
I.truecolor = 0;
|
||||
I.mouse = 0;
|
||||
I.cons_stack = r_stack_newf (6, cons_stack_free);
|
||||
I.break_stack = r_stack_newf (6, break_stack_free);
|
||||
|
|
|
@ -479,7 +479,7 @@ R_API int r_cons_grepbuf(char *buf, int len) {
|
|||
Color_RESET,
|
||||
NULL
|
||||
};
|
||||
char *out = r_print_json_indent (buf, I (use_color), " ", palette);
|
||||
char *out = r_print_json_indent (buf, I (color), " ", palette);
|
||||
if (!out) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ R_API char *r_cons_hud(RList *list, const char *prompt) {
|
|||
r_cons_printf (" %c %s\n", first_line? '-': ' ', current_entry);
|
||||
} else {
|
||||
// otherwise we need to emphasize the matching part
|
||||
if (I (use_color)) {
|
||||
if (I (color)) {
|
||||
last_color_change = 0;
|
||||
last_mask = 0;
|
||||
r_cons_printf (" %c ", first_line? '-': ' ');
|
||||
|
|
|
@ -371,12 +371,12 @@ R_API void r_cons_pal_show () {
|
|||
colors[i].bgcode,
|
||||
colors[i].name);
|
||||
}
|
||||
switch (r_cons_singleton ()->truecolor) {
|
||||
case 1: // 256 color palette
|
||||
switch (r_cons_singleton ()->color) {
|
||||
case COLORS_256: // 256 color palette
|
||||
r_cons_pal_show_gs ();
|
||||
r_cons_pal_show_256 ();
|
||||
break;
|
||||
case 2: // 16M
|
||||
case COLORS_16M: // 16M (truecolor)
|
||||
r_cons_pal_show_gs ();
|
||||
r_cons_pal_show_rgb ();
|
||||
break;
|
||||
|
|
|
@ -103,9 +103,6 @@ static void unrgb (int color, int *r, int *g, int *b) {
|
|||
|
||||
R_API void r_cons_rgb_init (void) {
|
||||
RCons *cons = r_cons_singleton ();
|
||||
if (cons->truecolor < 2) {
|
||||
return;
|
||||
}
|
||||
if (color_table[255] == 0) {
|
||||
init_color_table ();
|
||||
}
|
||||
|
@ -166,7 +163,7 @@ R_API char *r_cons_rgb_str_off(char *outstr, ut64 off) {
|
|||
return r_cons_rgb_str (outstr, r, g, b, false);
|
||||
}
|
||||
|
||||
/* Return color string depending on cons->truecolor */
|
||||
/* Return color string depending on cons->color */
|
||||
R_API char *r_cons_rgb_str(char *outstr, ut8 r, ut8 g, ut8 b, ut8 a) {
|
||||
ut8 fgbg = (a == ALPHA_BG)? 48: 38;
|
||||
if (!outstr) {
|
||||
|
@ -180,15 +177,15 @@ R_API char *r_cons_rgb_str(char *outstr, ut8 r, ut8 g, ut8 b, ut8 a) {
|
|||
sprintf (outstr, "%s", Color_RESET);
|
||||
return outstr;
|
||||
}
|
||||
switch (r_cons_singleton ()->truecolor) {
|
||||
case 1: // 256 color palette
|
||||
switch (r_cons_singleton ()->color) {
|
||||
case COLORS_256: // 256 color palette
|
||||
sprintf (outstr, "\x1b[%d;5;%dm", fgbg, rgb (r, g, b));
|
||||
break;
|
||||
case 2: // 16M - xterm only
|
||||
case COLORS_16M: // 16M (truecolor)
|
||||
sprintf (outstr, "\x1b[%d;2;%d;%d;%dm", fgbg, r, g, b);
|
||||
break;
|
||||
case 0: // ansi 16 colors
|
||||
default: {
|
||||
case COLORS_16: // ansi 16 colors
|
||||
{
|
||||
const char *bold = (a == ALPHA_BOLD)? "1;": "";
|
||||
int k = (r + g + b) / 3;
|
||||
r = (r >= k) ? 1 : 0;
|
||||
|
|
|
@ -958,7 +958,7 @@ static char *core_anal_graph_label(RCore *core, RAnalBlock *bb, int opts) {
|
|||
const bool scrColor = r_config_get (core->config, "scr.color");
|
||||
const bool scrUtf8 = r_config_get (core->config, "scr.utf8");
|
||||
const bool asmComments = r_config_get (core->config, "asm.comments");
|
||||
r_config_set (core->config, "scr.color", "false");
|
||||
r_config_set (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set (core->config, "scr.utf8", "false");
|
||||
r_config_set (core->config, "asm.comments", "false");
|
||||
snprintf (cmd, sizeof (cmd),
|
||||
|
|
|
@ -1010,10 +1010,10 @@ static int cb_color(void *user, void *data) {
|
|||
if (node->i_value) {
|
||||
core->print->flags |= R_PRINT_FLAGS_COLOR;
|
||||
} else {
|
||||
//c:core->print->flags ^= R_PRINT_FLAGS_COLOR;
|
||||
core->print->flags &= (~R_PRINT_FLAGS_COLOR);
|
||||
}
|
||||
r_cons_singleton ()->use_color = node->i_value? 1: 0;
|
||||
r_cons_singleton ()->color = (node->i_value > COLORS_16M)? COLORS_16M: node->i_value;
|
||||
r_cons_pal_update_event ();
|
||||
r_print_set_flags (core->print, core->print->flags);
|
||||
return true;
|
||||
}
|
||||
|
@ -1796,14 +1796,6 @@ static int cb_tracetag(void *user, void *data) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static int cb_truecolor(void *user, void *data) {
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
ut64 val = node->i_value > 2 ? 2 : node->i_value;
|
||||
r_cons_singleton ()->truecolor = val;
|
||||
r_cons_pal_update_event ();
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cb_utf8(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
|
@ -2788,8 +2780,7 @@ R_API int r_core_config_init(RCore *core) {
|
|||
SETCB ("scr.prompt", "true", &cb_scrprompt, "Show user prompt (used by r2 -q)");
|
||||
SETCB ("scr.tee", "", &cb_teefile, "Pipe output to file of this name");
|
||||
SETPREF ("scr.seek", "", "Seek to the specified address on startup");
|
||||
SETICB ("scr.truecolor", 0, &cb_truecolor, "Manage color palette (0: ansi 16, 1: 256, 2: 16M)");
|
||||
SETCB ("scr.color", (core->print->flags&R_PRINT_FLAGS_COLOR)?"true":"false", &cb_color, "Enable colors");
|
||||
SETICB ("scr.color", (core->print->flags&R_PRINT_FLAGS_COLOR)?COLORS_16:COLORS_DISABLED, &cb_color, "Enable colors (0: none, 1: ansi, 2: 256 colors, 3: truecolor)");
|
||||
SETCB ("scr.null", "false", &cb_scrnull, "Show no output");
|
||||
SETCB ("scr.utf8", r_cons_is_utf8()?"true":"false",
|
||||
&cb_utf8, "Show UTF-8 characters instead of ANSI");
|
||||
|
|
|
@ -1439,7 +1439,7 @@ R_API int r_core_cmd_pipe(RCore *core, char *radare_cmd, char *shell_cmd) {
|
|||
r_config_set_i (core->config, "scr.interactive", 0);
|
||||
if (!r_config_get_i (core->config, "scr.pipecolor")) {
|
||||
pipecolor = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", 0);
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
}
|
||||
if (*shell_cmd=='!') {
|
||||
r_cons_grep_parsecmd (shell_cmd, "\"");
|
||||
|
@ -1884,7 +1884,7 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd, char *colon) {
|
|||
r_config_set_i (core->config, "scr.html", true);
|
||||
} else if (!strcmp (ptr + 1, "T")) { // "|T"
|
||||
scr_color = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", false);
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
core->cons->use_tts = true;
|
||||
} else if (ptr[1]) { // "| grep .."
|
||||
int value = core->num->value;
|
||||
|
@ -1904,7 +1904,7 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd, char *colon) {
|
|||
scr_html = r_config_get_i (core->config, "scr.html");
|
||||
r_config_set_i (core->config, "scr.html", 0);
|
||||
scr_color = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", false);
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2063,7 +2063,7 @@ next:
|
|||
pipefd = r_cons_pipe_open (str, fdn, ptr[1] == '>');
|
||||
if (pipefd != -1) {
|
||||
if (!pipecolor) {
|
||||
r_config_set_i (core->config, "scr.color", 0);
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
}
|
||||
ret = r_core_cmd_subst (core, cmd);
|
||||
r_cons_flush ();
|
||||
|
|
|
@ -45,7 +45,7 @@ static const char *help_msg_ec[] = {
|
|||
"ec", " prompt red blue", "change color and background of prompt",
|
||||
"", " ", "",
|
||||
"colors:", "", "rgb:000, red, green, blue, #ff0000, ...",
|
||||
"e scr.truecolor", "=0", "use more colors (0: ansi 16, 1: 256, 2: 16M)",
|
||||
"e scr.color", "=0", "use more colors (0: no color 1: ansi 16, 2: 256, 3: 16M)",
|
||||
"$DATADIR/radare2/cons", "", "~/.config/radare2/cons ./",
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -1967,7 +1967,7 @@ static void disasm_strings(RCore *core, const char *input, RAnalFunction *fcn) {
|
|||
RConsPrintablePalette *pal = &core->cons->pal;
|
||||
// force defaults
|
||||
r_config_set_i (core->config, "asm.offset", true);
|
||||
r_config_set_i (core->config, "scr.color", 0);
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (core->config, "asm.tabs", 0);
|
||||
r_config_set_i (core->config, "asm.cmt.right", true);
|
||||
r_cons_push();
|
||||
|
|
|
@ -203,7 +203,7 @@ R_API int r_core_visual_hud(RCore *core) {
|
|||
char *homehud = r_str_home (R2_HOMEDIR "/hud");
|
||||
char *res = NULL;
|
||||
char *p = 0;
|
||||
r_cons_singleton ()->use_color = use_color;
|
||||
r_cons_singleton ()->color = use_color;
|
||||
|
||||
showcursor (core, true);
|
||||
if (c && *c && r_file_exists (c)) {
|
||||
|
|
|
@ -3150,7 +3150,7 @@ R_API void r_core_visual_colors(RCore *core) {
|
|||
}
|
||||
r_cons_gotoxy (0, 0);
|
||||
r_cons_rgb_str (cstr, rcolor.r, rcolor.g, rcolor.b, ALPHA_NORMAL);
|
||||
if (r_cons_singleton ()->truecolor < 2) {
|
||||
if (r_cons_singleton ()->color < COLORS_16M) {
|
||||
rcolor.r &= 0xf;
|
||||
rcolor.g &= 0xf;
|
||||
rcolor.b &= 0xf;
|
||||
|
|
|
@ -140,6 +140,8 @@ enum {
|
|||
};
|
||||
#endif
|
||||
|
||||
enum { COLORS_DISABLED = 0, COLORS_16, COLORS_256, COLORS_16M };
|
||||
|
||||
enum { ALPHA_RESET = 0x00, ALPHA_NORMAL = 0x01, ALPHA_BG = 0x02, ALPHA_BOLD = 0x03 };
|
||||
|
||||
typedef struct rcolor_t {
|
||||
|
@ -404,7 +406,7 @@ typedef struct r_cons_t {
|
|||
* current window. If NULL or "" no pager is used. */
|
||||
char *pager;
|
||||
int blankline;
|
||||
int truecolor; // 0 = ansi, 1 = rgb (256), 2 = truecolor (16M)
|
||||
int color; // 0 = none, 1 = ansi (16), 2 = palette (256), 3 = truecolor (16M)
|
||||
char *highlight;
|
||||
int null; // if set, does not show anything
|
||||
int mouse;
|
||||
|
@ -427,7 +429,6 @@ typedef struct r_cons_t {
|
|||
char *break_word;
|
||||
int break_word_len;
|
||||
ut64 timeout;
|
||||
bool use_color;
|
||||
bool grep_color;
|
||||
bool use_tts;
|
||||
bool filter;
|
||||
|
|
|
@ -57,7 +57,7 @@ function submit(cmd) {
|
|||
});
|
||||
}
|
||||
function ready() {
|
||||
r2.cmd("e scr.color=true");
|
||||
r2.cmd("e scr.color=3");
|
||||
var input = document.getElementById('input');
|
||||
input.focus();
|
||||
input.onkeypress = function(e){
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue