summaryrefslogtreecommitdiff
path: root/src/editor.c
diff options
context:
space:
mode:
authorBernhard R. Link <brlink@debian.org>2008-06-09 23:50:27 +0200
committerShawn <sabetts@juicebox.(none)>2008-10-22 14:17:43 -0700
commitd801644502adf42570e9a5b75fcaa013f613fc5a (patch)
treea30537a038c36c0effc0ab0f6f9f6565a206b558 /src/editor.c
parent22cea909c3d1b695424ef85153917b00bfb1261c (diff)
downloadratpoison-d801644502adf42570e9a5b75fcaa013f613fc5a.zip
define different history types and use them
(implementation does not separate them yet, though)
Diffstat (limited to 'src/editor.c')
-rw-r--r--src/editor.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/editor.c b/src/editor.c
index 21fbe63..b2a72f9 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -102,13 +102,14 @@ static edit_binding edit_bindings[] =
{ {0, 0}, 0} };
rp_input_line *
-input_line_new (char *prompt, char *preinput, completion_fn fn)
+input_line_new (char *prompt, char *preinput, int history_id, completion_fn fn)
{
rp_input_line *line;
line = xmalloc (sizeof (rp_input_line));
line->prompt = prompt;
line->compl = completions_new (fn);
+ line->history_id = history_id;
/* Allocate some memory to start with */
line->size = strlen (preinput) + 100;
@@ -358,7 +359,7 @@ static edit_status
editor_history_previous (rp_input_line *line)
{
#ifdef HAVE_HISTORY
- char *entry = history_previous ();
+ const char *entry = history_previous (line->history_id);
if (entry)
{
@@ -395,7 +396,7 @@ static edit_status
editor_history_next (rp_input_line *line)
{
#ifdef HAVE_HISTORY
- char *entry = history_next ();
+ const char *entry = history_next (line->history_id);
if (entry)
{
@@ -473,7 +474,7 @@ editor_enter (rp_input_line *line)
line->buffer[line->length] = '\0';
#ifdef HAVE_HISTORY
- result = history_expand_line (line->buffer, &expansion);
+ result = history_expand_line (line->history_id, line->buffer, &expansion);
PRINT_DEBUG (("History Expansion - result: %d\n", result));
PRINT_DEBUG (("History Expansion - expansion: \'%s\'\n", expansion));
@@ -486,7 +487,7 @@ editor_enter (rp_input_line *line)
}
else /* result == 0 || result == 1 */
{
- history_add (expansion);
+ history_add (line->history_id, expansion);
free (line->buffer);
line->buffer = expansion;
}