zoxide-menu outputs path prefixed with cwd
In my config I have
source vendor/nu_scripts/custom-menus/zoxide-menu.nu
and when I now press ctrl o and select a directory I end up with
$ C:\Users\jabdinghoff\IdeaProjects\C:\Users\jabdinghoff\AppData\Roaming\nushell
where the first part is my current working directory and the second part is what I selected
Sounds like a bug in the script. The nushell maintainers don't really support the scripts here but just the repo. Feel free to submit a fix for it and we could land it.
Maybe this is actually a nushell bug?
The script def has a faulty regex
It should be
zoxide query -ls $buffer
| parse -r '(?P<description>\d+(?:\.\d+)?)\s+(?P<value>.+)'
instead of https://github.com/nushell/nu_scripts/blob/765555beddc3c81555e6b70abb2542c37a1c0ad6/custom-menus/zoxide-menu.nu#L16-L17
which only gets the last digit from the decimal scores
But what looks like a bug to me:
def __test_menu [] {
{
name: test_menu
only_buffer_difference: true
marker: "| "
type: {
layout: columnar
page_size: 3
}
style: {
text: blue
selected_text: blue_reverse
description_text: yellow
}
source: { |buffer, position|
[{description: 0, value: "AAAA"}, {description: 1, value: "AAAB"}, {description: 3, value:"AAAC"}]
}
}
}
this here similarly selects AAAAAAC, so some kind of common prefix + selected
but the exact same setup with layout: list works as expected. Same with the zoxide menu, using list works flawlessly.
I will report this at the nushell repo and depending on that make a pr to fix the regex, i guess?
@ysthakur any ideas about this?
I think jabdinghoff is right, this is probably a Reedline bug with partial completions. The list menu's unaffected because it doesn't do partial completions, whereas the columnar and IDE menus do. I suspect the problem is in menu_functions::can_partially_complete (also, turns out find_common_string doesn't handle suggestions that are substrings of the first suggestion, not sure if that bug is related though).
I will report this at the nushell repo and depending on that make a pr to fix the regex, i guess?
Both of those would be helpful, but could you report this in the Reedline repo rather than the Nushell one?