* Honor console width in visual mode

- Fixes many glitches in disassembler and hex dumps
* Fix help for osx and w32 debugger IO plugins
This commit is contained in:
pancake 2011-03-24 22:47:06 +01:00
parent bfce422536
commit 6485b55de4
6 changed files with 21 additions and 7 deletions

1
TODO
View File

@ -6,6 +6,7 @@
* Ranged/scrollable zoom mode
* Add r_cons_prompt () ... calling set_prompt + fgets -- this api needs cleanup
- strict width in visual
* If [0-9] keybindings in visual point to same address use same reference
* Remove linestyle???
* Move the content of libr/*/TODO here

View File

@ -236,10 +236,24 @@ R_API void r_cons_visual_flush() {
}
R_API void r_cons_visual_write (char *buffer) {
int cols = I.columns;
int lines = I.rows-1;
const char *endptr;
char *nl, *ptr = buffer;
while (lines && (nl = strchr (ptr, '\n'))) {
r_cons_write (ptr, nl-ptr+1);
int clen, len = ((int)(size_t)(nl-ptr))+1;
#if 1
*nl = 0;
endptr = r_str_ansi_chrn (ptr, cols);
clen = (int)(size_t)(endptr-ptr)-1;
*nl = '\n';
if (clen>cols) {
ptr[clen-1]='\0';
len = clen;
}
ptr-=2;
#endif
r_cons_write (ptr, len); //nl-ptr+1);
lines--;
ptr = nl+1;
}

View File

@ -843,10 +843,9 @@ static void cmd_reg(RCore *core, const char *str) {
//r_cons_printf ("%s\n", core->anal->reg->reg_profile);
} else eprintf ("No register profile defined. Try 'dr.'\n");
} else r_reg_set_profile (core->dbg->reg, str+2);
core->anal->reg = core->dbg->reg;
break;
case 't':
for (i=0; (name=r_reg_get_type (i));i++)
for (i=0; (name=r_reg_get_type (i)); i++)
r_cons_printf ("%s\n", name);
break;
case 'n':

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
#include <r_userconf.h>
#include <r_debug.h>
@ -1008,7 +1008,7 @@ static int r_debug_native_reg_write(int pid, int tid, int type, const ut8* buf,
} else
if (type == R_REG_TYPE_GPR) {
#if __WINDOWS__
CONTEXT ctx __attribute__((aligned(16)));
CONTEXT ctx __attribute__((aligned (16)));
memcpy (&ctx, buf, sizeof (CONTEXT));
ctx.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
// eprintf ("EFLAGS =%x\n", ctx.EFlags);

View File

@ -204,7 +204,7 @@ static int __system(struct r_io_t *io, RIODesc *fd, const char *cmd) {
}
eprintf ("io_mach_system: Invalid pid\n");
return 1;
} else eprintf ("Try: '|pid'\n");
} else eprintf ("Try: '=!pid'\n");
return R_TRUE;
}

View File

@ -96,7 +96,7 @@ static int __system(RIO *io, RIODesc *fd, const char *cmd) {
io->printf ("\n");
//printf("PID=%d\n", io->fd);
return pid;
} else eprintf ("Try: '|pid'\n");
} else eprintf ("Try: '=!pid'\n");
return R_TRUE;
}