From 20d42b6313cf6bafe6f2a9421382673acf8c87d9 Mon Sep 17 00:00:00 2001 From: mizuki-y Date: Sat, 17 Jan 2026 18:53:06 +0900 Subject: [PATCH] Enhance console and history.rb: add '-f' flag to ARGV and reverse history filtering --- bin/console | 1 + lib/reline_pac/packages/history.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/console b/bin/console index 7d0013c..dcb1b99 100755 --- a/bin/console +++ b/bin/console @@ -16,4 +16,5 @@ RelinePac.configure do |config| end end +ARGV << '-f' IRB.start(__FILE__) diff --git a/lib/reline_pac/packages/history.rb b/lib/reline_pac/packages/history.rb index 0ea758c..c7bfd67 100644 --- a/lib/reline_pac/packages/history.rb +++ b/lib/reline_pac/packages/history.rb @@ -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| stripped = h.strip next if stripped.empty? || seen[stripped] @@ -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