Fix Vc conflict with colors

This commit is contained in:
pancake 2013-08-27 01:12:58 +02:00
parent 4b4db03fcd
commit 566ecb98b0

View File

@ -16,7 +16,6 @@ static int obs = 0;
static int curset = 0, cursor = 0, ocursor=-1; static int curset = 0, cursor = 0, ocursor=-1;
static int color = 1; static int color = 1;
static int debug = 1; static int debug = 1;
static int flags = R_PRINT_FLAGS_ADDRMOD;
static int zoom = 0; static int zoom = 0;
static int marks_init = 0; static int marks_init = 0;
@ -153,9 +152,10 @@ static int visual_nkey(RCore *core, int ch) {
} }
static void setcursor (RCore *core, int cur) { static void setcursor (RCore *core, int cur) {
int flags = core->print->flags; // wtf
curset = cur; curset = cur;
if (curset) flags|=R_PRINT_FLAGS_CURSOR; if (curset) flags |= R_PRINT_FLAGS_CURSOR;
else flags &= ~(flags&R_PRINT_FLAGS_CURSOR); else flags &= ~(R_PRINT_FLAGS_CURSOR);
r_print_set_flags (core->print, flags); r_print_set_flags (core->print, flags);
core->print->col = curset? 1: 0; core->print->col = curset? 1: 0;
} }
@ -262,7 +262,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
} }
break; break;
case 'c': case 'c':
setcursor (core, curset ^ 1); setcursor (core, curset?0:1);
break; break;
case 'C': case 'C':
color = color? 0: 1; color = color? 0: 1;
@ -930,9 +930,9 @@ static void r_core_visual_refresh (RCore *core) {
R_API int r_core_visual(RCore *core, const char *input) { R_API int r_core_visual(RCore *core, const char *input) {
const char *cmdprompt, *teefile; const char *cmdprompt, *teefile;
ut64 scrseek; ut64 scrseek;
int ch; int flags, ch;
obs = core->blocksize;
obs = core->blocksize;
core->vmode = R_TRUE; core->vmode = R_TRUE;
core->cons->event_data = core; core->cons->event_data = core;
core->cons->event_resize = \ core->cons->event_resize = \
@ -949,11 +949,14 @@ R_API int r_core_visual(RCore *core, const char *input) {
teefile = r_cons_singleton ()->teefile; teefile = r_cons_singleton ()->teefile;
r_cons_singleton ()->teefile = ""; r_cons_singleton ()->teefile = "";
core->print->flags |= R_PRINT_FLAGS_ADDRMOD;
do { do {
flags = core->print->flags;
color = r_config_get_i (core->config, "scr.color"); color = r_config_get_i (core->config, "scr.color");
if (color) flags |= R_PRINT_FLAGS_COLOR; if (color) flags |= R_PRINT_FLAGS_COLOR;
debug = r_config_get_i (core->config, "cfg.debug"); debug = r_config_get_i (core->config, "cfg.debug");
flags = R_PRINT_FLAGS_ADDRMOD | R_PRINT_FLAGS_HEADER; flags = R_PRINT_FLAGS_ADDRMOD | R_PRINT_FLAGS_HEADER;
r_print_set_flags (core->print, core->print->flags);
scrseek = r_num_math (core->num, scrseek = r_num_math (core->num,
r_config_get (core->config, "scr.seek")); r_config_get (core->config, "scr.seek"));
if (scrseek != 0LL) if (scrseek != 0LL)