Open LorenzoManfrediSegato opened 8 months ago
I'm also running into this same issue:
fish version: 3.7.1
tide version: 6.1.1
term: xterm-256color
os: macOS
terminal emulator: iTerm2
fish startup: 26.33 millis
fisher plugins: jorgebucaran/fisher ilancosman/tide@v6 edc/bass fabioantunes/fish-nvm
Those error messages seem to only happen when the terminal window is small enough such that the working directory path gets abbreviated.
TL;DR: are you using a pristine _tide_pwd.fish
? That may be the problem.
I have the same issue but this is because I modified _tide_pwd.fish
to remove a prefix from $PWD
. The reason is that I work on a virtual filesystem mounting a huge mono repo under /company/cloud/$USER/$PROJECT
, and:
/company/cloud/$USER/$PROJECT
prefix, I only care about the subdirectories, as I'm typically working in a given projectcloud/
and the first two levels below have a lot of users and projects directories (shared monorepo!).So I had the following diff:
10,11c10
< set -l pwd (string replace -r \"/company/cloud/depot/$USER/([^/]+)/\" '' \$PWD)
< if set -l split_pwd (string replace -r '^$HOME' '~' -- \$pwd | string split /)
---
> if set -l split_pwd (string replace -r '^$HOME' '~' -- \$PWD | string split /)
This breaks the logic for shortening path when it can't be displayed because the length of the prompt is larger than the terminal (minus other left and right prompt, which in tide is the dist_btwn_sides
variable).
The reason is that the logic tries to disambiguate by globing in each subdirectory, to truncate to a unique prefix AFAICT. IT has a strong assumption than when globing $parent_dir/$trunc
it will find entries and one of them will be $parent_dir/$dir_section
. That's a entirely valid assumption if you haven't messed with the initial $PWD. Its consequence is that the contains -i
instructions will always return an integer. But when messing with the prefix, the assumption no longer holds, and contains -i
returns nothing. You can repeat the error on the command line with:
$ set -e someval[(contains -i fruit carot potato cabbage)]
set: --erase: option requires an argument
(Type 'help set' for related documentation)
With that simple repro, you can devise a fix, by just adding a | echo
so that a (empty) string is returned:
$ set -e someval[(contains -i fruit carot potato cabbage | echo)]
In conclusion, for me, the problem was solved with the following additional diff.
32c31
< set -e glob[(contains -i \$parent_dir/\$dir_section/ \$glob | echo)] # This is faster than inverse string match
---
> set -e glob[(contains -i \$parent_dir/\$dir_section/ \$glob)] # This is faster than inverse string match
For @IlanCosman (thanks for Tide, it's amazing!) maybe you can add the | echo
hack? Note that I wasn't able to reproduce the problem with a pristine _tide_pwd.fish
even with a very narrow terminal, or in a git repo. So I strongly suspect that the cause is the OP tinkering. Or maybe being in a situation where glob
returns nothing (maybe some intermediate dir has some weird permissions?).
Alternatively, it would be nice to have an option to disable the disambiguation logic, as the glob can be costly for non-local, non-sparse directories.
Finally, I tried to clone the directory and worked on this issue by running make test
but that tries to do a make install
, and even if commenting that, most test fails. What is the process for developing on Tide? I'd be happy to contribute but I need a good rinse & repeat setup.
Same problem here, these are my versions,
The problem in my case only reproduces when i have python virtualenv active and i resize the terminal window/tab.
Applied the fix suggested by @Xadeck and problem gone, thank you so much
Describe the bug
After entering a git directory, every command/input entered into iTerm 2 yields the following message printed:
Typing "help set" directs me back to the most recent existing open browser tab
Steps to reproduce
Screenshots
Video: https://github.com/IlanCosman/tide/assets/51752036/7d7c0be6-f3e3-46dc-826c-40b8c49a85cd
Environment
Output of
tide bug-report
:Additional context