I'm attaching a 3-part patch that is one possible solution to this. It creates an extra slot in the History ring for a scratch buffer (at h->last). If you are editing inside that buffer, it is preserved when you scroll up/down through the history. Editing while in other places in history are *not* preserved with this patch.
I thought about creating a scratch history array instead, and trying to preserve all edits in a temporary history array until done. But that seemed a lot more complexity and work for a smaller usage case. Of course if other people think that's important I'll be glad to work on that alternative. Another behavior change worth noting with this patch: the position in history is now reset to the scratch buffer after each input entry. Before, the position would be stay wherever it was - you didn't restart at the "bottom" each time. history.c | 10 +++++----- enter.c | 1 + history.c | 10 ++++++++++ history.h | 1 + enter.c | 10 ++++++++++ history.c | 31 ++++++++++++++++++++++++++++--- history.h | 2 ++ 7 files changed, 57 insertions(+), 8 deletions(-)
