mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-08 06:47:33 +00:00
Fix autocompletion for :.<tab> for r2frida ##shell
This commit is contained in:
parent
9854d41cc2
commit
db7741247e
@ -2880,7 +2880,7 @@ static void cmd_autocomplete(RCore *core, const char *input) {
|
||||
arg[end - input] = 0;
|
||||
RCoreAutocomplete* a = r_core_autocomplete_find (b, arg, true);
|
||||
input = r_str_trim_head_ro (end);
|
||||
if (input && *input && !a) {
|
||||
if (R_STR_ISNOTEMPTY (input) && !a) {
|
||||
if (b->type == R_CORE_AUTOCMPLT_DFLT && !(b = r_core_autocomplete_add (b, arg, R_CORE_AUTOCMPLT_DFLT, false))) {
|
||||
eprintf ("ENOMEM\n");
|
||||
return;
|
||||
@ -2888,7 +2888,7 @@ static void cmd_autocomplete(RCore *core, const char *input) {
|
||||
eprintf ("Cannot add autocomplete to '%s'. type not $dflt\n", b->cmd);
|
||||
return;
|
||||
}
|
||||
} else if ((!input || !*input) && !a) {
|
||||
} else if (R_STR_ISEMPTY (input) && !a) {
|
||||
if (arg[0] == '$') {
|
||||
int type = autocomplete_type (arg);
|
||||
if (type != R_CORE_AUTOCMPLT_END && !b->locked && !b->n_subcmds) {
|
||||
@ -2906,7 +2906,7 @@ static void cmd_autocomplete(RCore *core, const char *input) {
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if ((!input || !*input) && a) {
|
||||
} else if (R_STR_ISEMPTY (input) && a) {
|
||||
// eprintf ("Cannot add '%s'. Already exists.\n", arg);
|
||||
return;
|
||||
} else {
|
||||
|
@ -1727,7 +1727,7 @@ static void autocomplete_macro(RCore *core, RLineCompletion *completion, const c
|
||||
}
|
||||
|
||||
static void autocomplete_file(RLineCompletion *completion, const char *str) {
|
||||
r_return_if_fail (str);
|
||||
r_return_if_fail (completion && str);
|
||||
char *pipe = strchr (str, '>');
|
||||
|
||||
if (pipe) {
|
||||
@ -1738,7 +1738,6 @@ static void autocomplete_file(RLineCompletion *completion, const char *str) {
|
||||
} else {
|
||||
autocomplete_process_path (completion, str, str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void autocomplete_ms_file(RCore* core, RLineCompletion *completion, const char *str) {
|
||||
@ -1905,7 +1904,7 @@ static bool find_autocomplete(RCore *core, RLineCompletion *completion, RLineBuf
|
||||
// handled before
|
||||
break;
|
||||
default:
|
||||
if (r_config_get_i (core->config, "cfg.newtab")) {
|
||||
if (r_config_get_b (core->config, "cfg.newtab")) {
|
||||
RCmdDescriptor *desc = &core->root_cmd_descriptor;
|
||||
for (i = 0; arg[i] && desc; i++) {
|
||||
ut8 c = arg[i];
|
||||
@ -1953,7 +1952,7 @@ R_API void r_core_autocomplete(R_NULLABLE RCore *core, RLineCompletion *completi
|
||||
/* XXX this doesn't handle filenames with spaces */
|
||||
// accept "> " and ">"
|
||||
char *pipe_space = pipe[1] == ' '
|
||||
? strchr (pipe+2, ' ')
|
||||
? strchr (pipe + 2, ' ')
|
||||
: strchr (pipe, ' ');
|
||||
bool should_complete = buf->data + buf->index >= pipe;
|
||||
if (pipe_space) {
|
||||
@ -1968,7 +1967,7 @@ R_API void r_core_autocomplete(R_NULLABLE RCore *core, RLineCompletion *completi
|
||||
}
|
||||
} else if (ptr) {
|
||||
char *ptr_space = ptr[1] == ' '
|
||||
? strchr (ptr+2, ' ')
|
||||
? strchr (ptr + 2, ' ')
|
||||
: strchr (ptr, ' ');
|
||||
bool should_complete = buf->data + buf->index >= ptr;
|
||||
if (ptr_space) {
|
||||
@ -2746,7 +2745,7 @@ static void __init_autocomplete_default(RCore* core) {
|
||||
"db-", "dbc", "dbC", "dbd", "dbe", "dbs", "dbi", "dbte", "dbtd", "dbts", NULL
|
||||
};
|
||||
const char *files[] = {
|
||||
".", "..", ".*", ":. ", "/F", "/m", "!", "!!", "#!c", "#!v", "#!cpipe", "#!vala", "v.",
|
||||
".", "..", ".*", "/F", "/m", "!", "!!", "#!c", "#!v", "#!cpipe", "#!vala", "v.",
|
||||
"#!rust", "#!zig", "#!pipe", "#!python", "aeli", "arp", "arpg", "dmd", "drp", "drpg", "o",
|
||||
"idp", "idpi", "L", "obf", "o+", "oc", "r2", "rabin2", "rasm2", "rahash2", "rax2",
|
||||
"rafind2", "cd", "ls", "on", "wf", "rm", "wF", "wp", "Sd", "Sl", "to", "pm",
|
||||
|
Loading…
x
Reference in New Issue
Block a user