summaryrefslogtreecommitdiffstats
path: root/history.c
diff options
context:
space:
mode:
authorAlain Bench <veronatif@free.fr>2006-07-04 17:23:16 +0000
committerAlain Bench <veronatif@free.fr>2006-07-04 17:23:16 +0000
commit86c449be7fdff9f4d67e5288f5ca355da37ab0c9 (patch)
tree83d599b3a6051ac38968db821f4818829c49139a /history.c
parentbddc24cd086bb3d0126ee4edc9d6de04d96fccfc (diff)
Adopt shell convention of omitting from the history commands prefixed
with a space.
Diffstat (limited to 'history.c')
-rw-r--r--history.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/history.c b/history.c
index a105b5ae..4bee9ab9 100644
--- a/history.c
+++ b/history.c
@@ -81,7 +81,12 @@ void mutt_history_add (history_class_t hclass, const char *s)
{
prev = h->last - 1;
if (prev < 0) prev = HistSize - 1;
- if (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0)
+
+ /* don't add to prompt history:
+ * - lines beginning by a space
+ * - repeated lines
+ */
+ if (*s != ' ' && (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0))
{
mutt_str_replace (&h->hist[h->last++], s);
if (h->last > HistSize - 1)