Fix Visual jk - prc interaction (#13578)

This commit is contained in:
Khairul Azhar Kasmiran 2019-04-01 00:22:07 +08:00 committed by radare
parent a98ddf66b2
commit f8dec83968
3 changed files with 16 additions and 5 deletions

View File

@ -545,21 +545,26 @@ static void cmd_print_init(RCore *core) {
DEFINE_CMD_DESCRIPTOR (core, pz);
}
R_API int r_core_get_prc_cols(RCore *core) {
int cols = r_config_get_i (core->config, "hex.pcols") + core->print->cols; // * 3.5;
cols /= 2;
if (cols < 1) {
cols = 1;
}
return cols;
}
// colordump
static void cmd_prc(RCore *core, const ut8* block, int len) {
const char *chars = " .,:;!O@#";
bool square = true; //false;
int i, j;
char ch, ch2, *color;
int cols = r_config_get_i (core->config, "hex.pcols") + core->print->cols; // * 3.5;
int cols = r_core_get_prc_cols (core);
bool show_color = r_config_get_i (core->config, "scr.color");
bool show_flags = r_config_get_i (core->config, "asm.flags");
bool show_cursor = core->print->cur_enabled;
bool show_unalloc = core->print->flags & R_PRINT_FLAGS_UNALLOC;
if (cols < 1) {
cols = 1;
}
cols /= 2;
for (i = 0; i < len; i += cols) {
r_print_addr (core->print, core->offset + i);
for (j = i; j < i + cols; j ++) {

View File

@ -2784,6 +2784,9 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
while (times--) {
if (isDisasmPrint (core->printidx)) {
r_core_visual_disasm_down (core, &op, &cols);
} else if (!strcmp (__core_visual_print_command (core),
"prc")) {
cols = r_core_get_prc_cols (core);
}
r_core_seek (core, core->offset + cols, 1);
}
@ -2851,6 +2854,8 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
while (times--) {
if (isDisasmPrint (core->printidx)) {
r_core_visual_disasm_up (core, &cols);
} else if (!strcmp (__core_visual_print_command (core), "prc")) {
cols = r_core_get_prc_cols (core);
}
r_core_seek_delta (core, -cols);
}

View File

@ -598,6 +598,7 @@ R_API int r_core_print_disasm_instructions (RCore *core, int len, int l);
R_API int r_core_print_disasm_all (RCore *core, ut64 addr, int l, int len, int mode);
R_API int r_core_disasm_pdi(RCore *core, int nb_opcodes, int nb_bytes, int fmt);
R_API int r_core_print_fcn_disasm(RPrint *p, RCore *core, ut64 addr, int l, int invbreak, int cbytes);
R_API int r_core_get_prc_cols(RCore *core);
R_API int r_core_flag_in_middle(RCore *core, ut64 at, int oplen, int *midflags);
R_API int r_core_bb_starts_in_middle(RCore *core, ut64 at, int oplen);
R_API int r_core_file_bin_raise (RCore *core, ut32 binfile_idx);