From 25a5917a8d553d4118b9c923898c55d7d751eec5 Mon Sep 17 00:00:00 2001 From: VioletsOleander <1377232072@qq.com> Date: Sat, 13 Jun 2026 21:14:47 +0800 Subject: [PATCH] fix: support completion for file name that contains whitespace --- custom-completions/git/git-completions.nu | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom-completions/git/git-completions.nu b/custom-completions/git/git-completions.nu index bf491f78f..c6f95913a 100644 --- a/custom-completions/git/git-completions.nu +++ b/custom-completions/git/git-completions.nu @@ -238,11 +238,11 @@ def "nu-complete git files" [path?: string] { | first 300 # limit the number of data for performance | each { |$it| if $it starts-with "1 " { - $it | parse --regex "1 (?P\\S+) (?:\\S+\\s?){6} (?P\\S+)" + $it | parse --regex "1 (?P\\S+) (?:\\S+\\s?){6} (?P.+)" } else if $it starts-with "2 " { - $it | parse --regex "2 (?P\\S+) (?:\\S+\\s?){6} (?P\\S+)" + $it | parse --regex "2 (?P\\S+) (?:\\S+\\s?){6} (?P.+)" } else if $it starts-with "u " { - $it | parse --regex "u (?P\\S+) (?:\\S+\\s?){8} (?P\\S+)" + $it | parse --regex "u (?P\\S+) (?:\\S+\\s?){8} (?P.+)" } else if $it starts-with "? " { $it | parse --regex "(?P.{1}) (?P.+)" } else { @@ -251,6 +251,7 @@ def "nu-complete git files" [path?: string] { } | flatten | where $it.short_status in $relevant_statuses + | update value { |row| if ($row.value | str contains " ") { $"`($row.value)`" } else { $row.value } } | insert "description" { |e| $short_status_descriptions | get $e.short_status} }