Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ RelinePac.configure do |config|
end
end

ARGV << '-f'
IRB.start(__FILE__)
4 changes: 2 additions & 2 deletions lib/reline_pac/packages/history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def fzf_history(_key)
return if all_history.empty?

seen = {}
filtered = all_history.filter_map do |h|
filtered = all_history.reverse.filter_map do |h|
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reversing the history array before filtering changes the deduplication behavior. Previously, when a command appeared multiple times in history, the oldest occurrence was kept (since the array was processed chronologically and the first occurrence was added to the 'seen' hash). Now, the newest occurrence will be kept. While this might be the intended behavior, it's a semantic change that affects which duplicate entry is preserved. Consider whether this change in deduplication logic is intentional and whether it should be documented or tested.

Copilot uses AI. Check for mistakes.
stripped = h.strip
next if stripped.empty? || seen[stripped]

Expand All @@ -23,7 +23,7 @@ def fzf_history(_key)
display = filtered.map { |h| h.gsub("\n", '⏎') }

selected_index = nil
::IO.popen("fzf --tac --reverse --border --query='#{line}' --with-nth=1 --delimiter=$'\\t'", 'r+') do |io|
::IO.popen("fzf --reverse --border --query='#{line}' --with-nth=1 --delimiter=$'\\t'", 'r+') do |io|
display.each_with_index { |d, i| io.puts "#{d}\t#{i}" }
io.close_write
result = io.read.strip
Expand Down
Loading