Skip to content

Commit

Permalink
fix disappearing fzf matches (#363)
Browse files Browse the repository at this point in the history
* fix disappearing fzf matches

* add back the withenv do block

---------

Co-authored-by: sandyspiers <[email protected]>
  • Loading branch information
sandyspiers and sandyspiers committed Aug 5, 2024
1 parent 7f881f9 commit 70bacf2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,19 @@ function create_keybindings()
#replace search with Fzf fuzzy search
D["^R"] = function (s, data, c)
if VERSION >= v"1.3" && OhMyREPL.ENABLE_FZF[]
current_line = LineEdit.input_string(s)
if !isempty(current_line)
line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%", "--query=$current_line");
else
line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%");
end
if isempty(line)
line = current_line
withenv("FZF_DEFAULT_OPTS" => nothing) do
current_line = LineEdit.input_string(s)
if !isempty(current_line)
line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%", "--query=$current_line")
else
line = JLFzf.inter_fzf(JLFzf.read_repl_hist(), "-m", "--read0", "--tiebreak=index", "--height=80%")
end
if isempty(line)
line = current_line
end
JLFzf.insert_history_to_repl(s, line)
end
rewrite_with_ANSI(s)
else
p = Base.active_repl.interface.modes[4]
LineEdit.enter_search(s, p, true)
Expand Down

0 comments on commit 70bacf2

Please sign in to comment.