From 0076018ada7b294df87df365304d1abc71c6ce4a Mon Sep 17 00:00:00 2001 From: Lam Chau Date: Fri, 6 Jun 2025 13:24:02 -0700 Subject: [PATCH] fix: add version check for fish v4+ --- shell/navi.plugin.fish | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/shell/navi.plugin.fish b/shell/navi.plugin.fish index 419906e..4b05a40 100644 --- a/shell/navi.plugin.fish +++ b/shell/navi.plugin.fish @@ -1,11 +1,24 @@ function _navi_smart_replace set --local query (commandline --current-process | string trim) + set --local version_parts "" + if test -n "$version" + set version_parts (string split '.' $version) + else + set version_parts (string split '.' (string match -r '\d+\.\d+\.\d+' (fish --version))) + end + + set --local force_repaint false + if test $version_parts[1] -ge 4 + set force_repaint true + end if test -n "$query" set --local best_match (navi --print --query "$query" --best-match) if test -n "$best_match" commandline --current-process $best_match - commandline -f repaint + if test "$force_repaint" = true + commandline -f repaint + end return end end @@ -13,7 +26,9 @@ function _navi_smart_replace set --local candidate (navi --print --query "$query") if test -n "$candidate" commandline --current-process $candidate - commandline -f repaint + if test "$force_repaint" = true + commandline -f repaint + end end end