Configuration Information [Automatically generated]: Machine: x86_64 OS: linux-gnu Compiler: x86_64-pc-linux-gnu-gcc Compilation CFLAGS: -march=native -O2 -pipe -Wno-parentheses -Wno-format-security uname output: Linux primeval 5.4.30-gentoo #33 SMP Wed Jul 29 00:03:46 EDT 2020 x86_64 AMD Ryzen 7 3700X 8-Core Processor AuthenticAMD GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0 Patch Level: 17 Release Status: release Description: During history search, Bash allows one to correct the search term by backspacing, e.g. after making a typo, but it fails to correct the search position in response. A typo is like a ‘wrong turn at Albuquerque’, it can get one lost. Backspacing and erasing part of the search term *should* take one back to Albuquerque, but does not; while it corrects the search term, it fails to correct the search position (inconsistency) which leaves one lost. Repeat-By: During a history search, I make a typo while entering the search term (wrong term!). Bash either finds a match for my typo, or it beeps at me. In either case, the search position has now changed, leaving me somewhere in the middle of history (wrong place!). I backspace to undo my typo. This undoes the typo, but (here is the bug) does not undo the change to the search position. Still I am at the wrong place. As I retype the search term (correctly this time), the results are not what I expect. I remain lost in Bash history. I could find no satisfactory workarounds. See e.g. https://unix.stackexchange.com/q/523543. Fix: I think the following might work. It seems to be how Emacs works during interactive text searches. As the user backspaces stepwise over a search term, reverting at each step to a previous value, revert the search position to *its* correponding, previous value. -- Michael Allan Toronto, +1 416 699 9528 http://reluk.ca/