hanslub42 / rlwrap

A readline wrapper
GNU General Public License v2.0
2.59k stars 151 forks source link

--history-no-dupes 2 gives unexpected results #154

Closed nkh closed 2 years ago

nkh commented 2 years ago

command: order=$(rlwrap --history-no-dupes 2 -pYellow -S 'Your pizza? ' -H past_orders -P Margherita -o ./silent)

past_orders file contents: Margheritarlökmefref Margherita Margheritaxxx Margherita Margheritaxxx Margherita

I expected the history to be like listing below when n is 2 Margheritarlökmefref Margheritaxxx Margherita

hanslub42 commented 2 years ago

--history-no-dupes 2 only influences what is put in the history file for the current session. It does not rewrite history

I agree that the manual suggests otherwise:

n = 2 will make rlwrap drop all previous occurrences of the current input from the list.

I prefer the current behaviour as less intrusive (and it wouldn't be difficult to write a script to sanitise your duplicate-ridden history file)

I'll mark this as a "manpage bug"

hanslub42 commented 2 years ago

Clarified this in manpage (see 9d6d5f1d3bdccc3144cc076ad7335e06326da4b9)