mirror of
https://github.com/denisidoro/navi.git
synced 2026-07-17 16:49:25 +00:00
fix: always repaint prompt after fzf exits in fish widget
Previously, `repaint` only ran inside the `best_match` and `candidate` branches, so cancelling out of navi (Ctrl+C / Esc) without selecting a snippet would leave the terminal in a clobbered state. Multi-line prompts (e.g. tide with ╭─/╰─ borders) would lose their border characters because fzf overwrites the terminal output and no repaint was triggered to restore it. Move `repaint` to the end of the function so it always runs regardless of whether a selection was made, the user cancelled, or no matches were found. Remove the early `return` from the `best_match` branch and gate the `candidate` fallback with `test -z "$best_match"` instead.
This commit is contained in:
parent
ec04fa91b4
commit
aa87ad49cd
1 changed files with 10 additions and 10 deletions
|
|
@ -28,21 +28,21 @@ function _navi_smart_replace
|
|||
# boundaries and flattens multi-line snippets into a single line
|
||||
commandline --replace -- "$best_match"
|
||||
commandline --function end-of-line
|
||||
if test "$force_repaint" = true
|
||||
commandline --function repaint
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
set --local candidate (navi --print --query "$query")
|
||||
if test -n "$candidate"
|
||||
commandline --replace -- "$candidate"
|
||||
commandline --function end-of-line
|
||||
if test "$force_repaint" = true
|
||||
commandline --function repaint
|
||||
if test -z "$best_match"
|
||||
set --local candidate (navi --print --query "$query")
|
||||
if test -n "$candidate"
|
||||
commandline --replace -- "$candidate"
|
||||
commandline --function end-of-line
|
||||
end
|
||||
end
|
||||
|
||||
# always repaint to restore the prompt after fzf clobbers the terminal
|
||||
if test "$force_repaint" = true
|
||||
commandline --function repaint
|
||||
end
|
||||
end
|
||||
|
||||
bind \cg _navi_smart_replace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue