Hi Chet,
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.
Best,
John Lin
Chet Ramey <[email protected]> 於 2019年2月1日 週五 下午10:49寫道:
> On 1/31/19 7:51 PM, 林自均 wrote:
> > Hi Chet,
> >
> > I was doing the experiment on my macOS, and the bash version is 3.2.57.
> > After that, I tried again with my Ubuntu, which has bash 4.4.19, can't
> > reproduce that. Maybe it's because of the bash version?
>
> Yes. revert-all-at-newline wasn't introduced until bash-4.0.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
>
_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline