This makes it so that the "scratch buffer" entry is used by default, and allows mutt to preserve what the user types if they go through history and back.
enter.c | 1 + history.c | 10 ++++++++++ history.h | 1 + 3 files changed, 12 insertions(+), 0 deletions(-)
# HG changeset patch # User Kevin McCarthy <[email protected]> # Date 1367102432 25200 # Branch HEAD # Node ID 6508708727911b0f792175ec3ce353bc31481d3f # Parent 004fe04e05c7a26067af3bd71985b826430872a4 Reset history state after exiting mutt_enter_string (see #3082) This makes it so that the "scratch buffer" entry is used by default, and allows mutt to preserve what the user types if they go through history and back. diff --git a/enter.c b/enter.c --- a/enter.c +++ b/enter.c @@ -727,16 +727,17 @@ mutt_flushinp (); BEEP (); } } } bye: + mutt_reset_history_state (hclass); FREE (&tempbuf); return rv; } void mutt_free_enter_state (ENTER_STATE **esp) { if (!esp) return; diff --git a/history.c b/history.c --- a/history.c +++ b/history.c @@ -277,8 +277,18 @@ prev = HistSize; while (prev > 0 && h->hist[prev] == NULL) prev--; } if (h->hist[prev]) h->cur = prev; return (h->hist[h->cur] ? h->hist[h->cur] : ""); } + +void mutt_reset_history_state (history_class_t hclass) +{ + struct history *h = GET_HISTORY(hclass); + + if (!HistSize || !h) + return; /* disabled */ + + h->cur = h->last; +} diff --git a/history.h b/history.h --- a/history.h +++ b/history.h @@ -36,10 +36,11 @@ typedef enum history_class history_class_t; void mutt_init_history(void); void mutt_read_histfile(void); void mutt_history_add(history_class_t, const char *, int); char *mutt_history_next(history_class_t); char *mutt_history_prev(history_class_t); +void mutt_reset_history_state (history_class_t); #endif
