mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-22 23:31:26 +00:00
Add the new ucu and ucd commands using the new core-undo apis ##shell
This commit is contained in:
parent
866f0417a9
commit
176c4c40a8
@ -296,10 +296,8 @@ static RCoreHelpMessage help_msg_uc = {
|
||||
"uc", " w hello,w world", "add a new undo command manually",
|
||||
"uc", "", "list all core undos commands",
|
||||
"uc*", "", "list all core undos as r2 commands",
|
||||
#if R2_580
|
||||
"ucu", "", "up : undo previous action",
|
||||
"ucd", "", "down : redo action",
|
||||
#endif
|
||||
"uc-", "", "undo last action",
|
||||
"uc.", "", "list all reverts in current",
|
||||
NULL
|
||||
@ -656,7 +654,6 @@ static int cmd_undo(void *data, const char *input) {
|
||||
case '-': // "uc-"
|
||||
r_core_undo_pop (core);
|
||||
break;
|
||||
#if R2_580
|
||||
case 'u': // "ucu"
|
||||
r_core_undo_up (core);
|
||||
break;
|
||||
@ -665,7 +662,6 @@ static int cmd_undo(void *data, const char *input) {
|
||||
r_core_undo_down (core);
|
||||
r_config_set_b (core->config, "cmd.undo", true);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
r_core_undo_print (core, 0, NULL);
|
||||
break;
|
||||
|
@ -32,9 +32,7 @@ R_API void r_core_undo_free(RCoreUndo *cu) {
|
||||
R_API void r_core_undo_push(RCore *core, RCoreUndo *cu) {
|
||||
r_return_if_fail (core && cu);
|
||||
r_list_append (core->undos, cu);
|
||||
#if R2_580
|
||||
core->undoindex ++;
|
||||
#endif
|
||||
}
|
||||
|
||||
R_API void r_core_undo_pop(RCore *core) {
|
||||
@ -76,11 +74,7 @@ R_API void r_core_undo_print(RCore *core, int mode, RCoreUndoCondition *cond) {
|
||||
ut64 now = r_time_now ();
|
||||
int i = 0;
|
||||
r_list_foreach (core->undos, iter, cu) {
|
||||
#if R2_580
|
||||
const char * arrow = (i == core->undoindex - 1)? "*": "-";
|
||||
#else
|
||||
const char * arrow = "-";
|
||||
#endif
|
||||
r_cons_printf ("%s 0x%08"PFMT64x" old:% ds cmd: %s (revert: %s)\n",
|
||||
arrow, cu->offset, (int)((now - cu->tstamp) / 1000000), cu->action, cu->revert);
|
||||
i++;
|
||||
@ -88,7 +82,6 @@ R_API void r_core_undo_print(RCore *core, int mode, RCoreUndoCondition *cond) {
|
||||
}
|
||||
}
|
||||
|
||||
#if R2_580
|
||||
R_API void r_core_undo_down(RCore *core) {
|
||||
// undo
|
||||
int undos = r_list_length (core->undos);
|
||||
@ -117,4 +110,3 @@ R_API void r_core_undo_up(RCore *core) {
|
||||
}
|
||||
r_config_set_b (core->config, "cmd.undo", cmd_undo);
|
||||
}
|
||||
#endif
|
||||
|
@ -346,9 +346,7 @@ struct r_core_t {
|
||||
char *cmdfilter;
|
||||
bool break_loop;
|
||||
RList *undos;
|
||||
#if R2_580
|
||||
int undoindex;
|
||||
#endif
|
||||
bool binat;
|
||||
bool fixedbits; // will be true when using @b:
|
||||
bool fixedarch; // will be true when using @a:
|
||||
@ -862,10 +860,8 @@ R_API void r_core_undo_print(RCore *core, int mode, RCoreUndoCondition *cond);
|
||||
R_API void r_core_undo_free(RCoreUndo *cu);
|
||||
R_API void r_core_undo_push(RCore *core, RCoreUndo *cu);
|
||||
R_API void r_core_undo_pop(RCore *core);
|
||||
#if R2_580
|
||||
R_API void r_core_undo_up(RCore *core);
|
||||
R_API void r_core_undo_down(RCore *core);
|
||||
#endif
|
||||
|
||||
/* logs */
|
||||
typedef int (*RCoreLogCallback)(RCore *core, int count, const char *message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user