summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQball Cow <qball@blame.services>2024-02-28 00:46:23 +0100
committerQball Cow <qball@blame.services>2024-02-28 00:46:23 +0100
commitee1b68aea63ea890e6632b248f59198853cc4b55 (patch)
tree389ab287eb7d636b535b39bad5d67867fd926167
parenteae65b2c07c7d1dc2205c09355e8d35da21690a4 (diff)
[Run] When passing raw entry, pass it unquoted to history
fixes: #1951
-rw-r--r--source/modes/run.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/modes/run.c b/source/modes/run.c
index 581a9a5c..1472a094 100644
--- a/source/modes/run.c
+++ b/source/modes/run.c
@@ -94,7 +94,7 @@ typedef struct {
*
* Execute command and add to history.
*/
-static gboolean exec_cmd(const char *cmd, int run_in_term) {
+static gboolean exec_cmd(const char *cmd, int run_in_term, const char *orig) {
GError *error = NULL;
if (!cmd || !cmd[0]) {
return FALSE;
@@ -118,12 +118,12 @@ static gboolean exec_cmd(const char *cmd, int run_in_term) {
* It is allowed to be a bit slower.
*/
- history_set(path, cmd);
+ history_set(path, orig);
g_free(path);
g_free(lf_cmd);
return TRUE;
}
- history_remove(path, cmd);
+ history_remove(path, orig);
g_free(path);
g_free(lf_cmd);
return FALSE;
@@ -445,13 +445,13 @@ static ModeMode run_mode_result(Mode *sw, int mretv, char **input,
if (retv == MODE_EXIT) {
if (path == NULL) {
char *arg = g_shell_quote(rmpd->cmd_list[rmpd->selected_line].entry);
- exec_cmd(arg, run_in_term);
+ exec_cmd(arg, run_in_term, rmpd->cmd_list[rmpd->selected_line].entry);
g_free(arg);
} else {
char *earg = g_shell_quote(rmpd->cmd_list[rmpd->selected_line].entry);
char *epath = g_shell_quote(path);
char *arg = g_strdup_printf("%s %s", earg, epath);
- exec_cmd(arg, run_in_term);
+ exec_cmd(arg, run_in_term, arg);
g_free(arg);
g_free(earg);
g_free(epath);
@@ -464,13 +464,13 @@ static ModeMode run_mode_result(Mode *sw, int mretv, char **input,
if ((mretv & MENU_OK) && rmpd->cmd_list[selected_line].entry != NULL) {
char *earg = g_shell_quote(rmpd->cmd_list[selected_line].entry);
- if (!exec_cmd(earg, run_in_term)) {
+ if (!exec_cmd(earg, run_in_term, rmpd->cmd_list[selected_line].entry)) {
retv = RELOAD_DIALOG;
}
g_free(earg);
} else if ((mretv & MENU_CUSTOM_INPUT) && *input != NULL &&
*input[0] != '\0') {
- if (!exec_cmd(*input, run_in_term)) {
+ if (!exec_cmd(*input, run_in_term, *input)) {
retv = RELOAD_DIALOG;
}
} else if ((mretv & MENU_ENTRY_DELETE) &&