withfig / autocomplete

IDE-style autocomplete for your existing terminal & shell

Home Page:https://fig.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ls] ANSI color escape codes showing up in file names

excursus opened this issue · comments

Sanity checks

  • My issue relates to a specific CLI completion spec (e.g. git checkout is missing options in git completion spec). If your issue is more general, please create your issue here: withfig/fig
  • I have searched github.com/withfig/autocomplete/issues and there are no duplicates of my issue
  • I would like to work on this.

What CLI tool does this relate to?

ls

Which statement makes the most sense?

There is a bug with this completion spec

Issue Details

I'm seeing ascii escape codes in file names like this:
image
Is this intended behavior?

That is wild!! Have never seen this happen before 😄 @fedeci

This looks like it might be a bug in the autocomplete engine itself because ls uses the builtin generators. Will have a go at fixing myself

@excursus Looks like you're running fish, what fish version is it? (fish --version) and do you have a file named ls.fish in your ~/.config/fish/functions folder?

Sorry for the spam - one more thing to check, do the file names actually have escape codes in them? Given that fish is also suggesting the escape codes, it looks like they might... for some reason. Try running this command and send us the output 🙂

for file in *; echo $file; math (echo $file | wc -c) - 1; end

Thanks for looking into this! Here are the answers to your questions:

  • fish version 3.3.1
  • I don't have an ls.fish in ~/.config/fish/functions.
  • Running the above command produces:
test1
5
test2
5

The problem seems to be cause by the following line in my config.fish:
set -Ux CLICOLOR_FORCE 1
If I uncomment this line the problem goes away.