mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-04 04:28:20 +00:00
Obey scr.color in RConsCanvas from RCore.cmd("VV")
This commit is contained in:
parent
e1fec8fcab
commit
421dd1243f
@ -31,6 +31,7 @@ R_API RConsCanvas* r_cons_canvas_new (int w, int h) {
|
||||
return NULL;
|
||||
c = R_NEW0 (RConsCanvas);
|
||||
if (!c) return NULL;
|
||||
c->color = 0;
|
||||
c->sx = 0;
|
||||
c->sy = 0;
|
||||
c->blen = (w+1)*h;
|
||||
@ -114,6 +115,8 @@ static char *prefixline(RConsCanvas *c, int *left) {
|
||||
}
|
||||
|
||||
static char ** attr_at(RConsCanvas *c,int loc){
|
||||
if (!c->color)
|
||||
return NULL;
|
||||
if(c->attrslen==0) return NULL;
|
||||
int i;
|
||||
for(i=0;i<(c->attrslen);i++){
|
||||
|
@ -504,11 +504,14 @@ R_API int r_core_visual_graph(RCore *core, RAnalFunction *_fcn) {
|
||||
}
|
||||
w = r_cons_get_size (&h);
|
||||
can = r_cons_canvas_new (w-1, h-1);
|
||||
can->color = r_config_get_i (core->config, "scr.color");
|
||||
// disable colors in disasm because canvas doesnt supports ansi text yet
|
||||
r_config_set_i (core->config, "scr.color", 0);
|
||||
//can->color = 0;
|
||||
if (!can) {
|
||||
eprintf ("Cannot create RCons.canvas context\n");
|
||||
return R_FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
n_nodes = bbNodes (core, fcn, &nodes);
|
||||
if (!nodes) {
|
||||
@ -689,7 +692,8 @@ repeat:
|
||||
core->vmode = R_TRUE;
|
||||
break;
|
||||
case 'C':
|
||||
r_config_swap (core->config, "scr.color");
|
||||
can->color = !!!can->color;
|
||||
//r_config_swap (core->config, "scr.color");
|
||||
// refresh graph
|
||||
reloadNodes (core);
|
||||
break;
|
||||
|
@ -973,7 +973,6 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
r_core_cmd0 (core, "agv $$");
|
||||
} else {
|
||||
int ocolor = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", !!!ocolor);
|
||||
r_core_visual_graph (core, NULL);
|
||||
r_config_set_i (core->config, "scr.color", ocolor);
|
||||
}
|
||||
|
@ -128,6 +128,7 @@ typedef struct r_cons_canvas_t {
|
||||
int attrslen;
|
||||
int sx; // scrollx
|
||||
int sy; // scrolly
|
||||
int color;
|
||||
} RConsCanvas;
|
||||
|
||||
typedef char *(*RConsEditorCallback)(void *core, const char *file, const char *str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user