For Frederick's problem, I suppose that is a bug. Here is my proposed patch (against bash code base):
diff --git a/lib/readline/misc.c b/lib/readline/misc.c
index 64b1457d..6aed8e64 100644
--- a/lib/readline/misc.c
+++ b/lib/readline/misc.c
@@ -446,7 +446,8 @@ _rl_revert_all_lines (void)
saved_undo_list = rl_undo_list;
hpos = where_history ();
- entry = (hpos == history_length) ? previous_history () : current_history ();
+ history_set_pos (history_length);
+ entry = previous_history ();
while (entry)
{
if (ul = (UNDO_LIST *)entry->data)
The root cause was that the variable "entry" should have pointed to the latest history entry, but it pointed to the current history instead. If I am missing anything, please let me know. Thanks.