]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-5.0 patch 12: fix problems moving back beyond start of history
authorChet Ramey <chet.ramey@case.edu>
Fri, 7 Feb 2020 20:16:28 +0000 (15:16 -0500)
committerChet Ramey <chet.ramey@case.edu>
Fri, 7 Feb 2020 20:16:28 +0000 (15:16 -0500)
lib/readline/misc.c
patchlevel.h

index 64b1457d29e8af0bcefc6553ca97e93cf0cd6ad0..42005b0c1ec53d4dfb751b0a026b77913cbe1bad 100644 (file)
@@ -576,6 +576,7 @@ int
 rl_get_previous_history (int count, int key)
 {
   HIST_ENTRY *old_temp, *temp;
+  int had_saved_line;
 
   if (count < 0)
     return (rl_get_next_history (-count, key));
@@ -588,6 +589,7 @@ rl_get_previous_history (int count, int key)
     _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
 
   /* If we don't have a line saved, then save this one. */
+  had_saved_line = _rl_saved_line_for_history != 0;
   rl_maybe_save_line ();
 
   /* If the current line has changed, save the changes. */
@@ -611,7 +613,8 @@ rl_get_previous_history (int count, int key)
 
   if (temp == 0)
     {
-      rl_maybe_unsave_line ();
+      if (had_saved_line == 0)
+        _rl_free_saved_history_line ();
       rl_ding ();
     }
   else
index 772676c8135fe7ef5f65e594d77e988e46ca69cb..93dbe0db3da2cad9c9aa7a19866ddca7d3258dac 100644 (file)
@@ -25,6 +25,6 @@
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 11
+#define PATCHLEVEL 12
 
 #endif /* _PATCHLEVEL_H_ */