summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions.c16
-rw-r--r--src/data.h2
-rw-r--r--src/editor.c6
-rw-r--r--src/main.c1
4 files changed, 25 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index 702c419..120d106 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -74,6 +74,7 @@ static cmdret * set_infofmt (struct cmdarg **args);
static cmdret * set_topkmap (struct cmdarg **args);
static cmdret * set_historysize (struct cmdarg **args);
static cmdret * set_historycompaction (struct cmdarg **args);
+static cmdret * set_historyexpansion (struct cmdarg **args);
LIST_HEAD(set_vars);
@@ -142,6 +143,7 @@ init_set_vars(void)
add_set_var ("topkmap", set_topkmap, 1, "", arg_STRING);
add_set_var ("historysize", set_historysize, 1, "", arg_NUMBER);
add_set_var ("historycompaction", set_historycompaction, 1, "", arg_NUMBER);
+ add_set_var ("historyexpansion", set_historyexpansion, 1, "", arg_NUMBER);
}
/* rp_keymaps is ratpoison's list of keymaps. */
@@ -3605,6 +3607,20 @@ set_historycompaction (struct cmdarg **args)
}
static cmdret *
+set_historyexpansion (struct cmdarg **args)
+{
+ if (args[0] == NULL)
+ return cmdret_new (RET_SUCCESS, "%d", defaults.history_expansion);
+#ifndef HAVE_HISTORY
+ if (ARG(0, number)) {
+ return cmdret_new (RET_FAILURE, "Not compiled with libhistory");
+ }
+#endif
+ defaults.history_expansion = ARG(0, number);
+ return cmdret_new (RET_SUCCESS, NULL);
+}
+
+static cmdret *
set_font (struct cmdarg **args)
{
#ifdef USE_XFT_FONT
diff --git a/src/data.h b/src/data.h
index 318e61c..a7785de 100644
--- a/src/data.h
+++ b/src/data.h
@@ -261,6 +261,8 @@ struct rp_defaults
int history_size;
/* remove older history when adding the same again */
int history_compaction;
+ /* expand ! when compiled with libhistory */
+ int history_expansion;
char *frame_selectors;
diff --git a/src/editor.c b/src/editor.c
index 0623186..23b6e35 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -457,6 +457,12 @@ editor_enter (rp_input_line *line)
char *expansion;
line->buffer[line->length] = '\0';
+
+ if (!defaults.history_expansion) {
+ history_add (line->history_id, line->buffer);
+ return EDIT_DONE;
+ }
+
result = history_expand_line (line->history_id, line->buffer, &expansion);
PRINT_DEBUG (("History Expansion - result: %d\n", result));
diff --git a/src/main.c b/src/main.c
index bb9fb7f..540bb6a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -564,6 +564,7 @@ init_defaults (void)
defaults.history_size = 20;
defaults.history_compaction = True;
+ defaults.history_expansion = False;
defaults.frame_selectors = xstrdup ("");
defaults.maxundos = 20;
}