devicon-lookup icon indicating copy to clipboard operation
devicon-lookup copied to clipboard

don't duplicate text after prefix when --color is used along --prefix

Open shadowwa opened this issue 1 year ago • 0 comments

when using --prefix along --color as done in https://github.com/coreyja/fzf.devicon.vim the text comming after the prefix is duplicated

it can be reproduced by

$ rg --column --line-number --no-heading --color=always --smart-case -- Extends vendor/smarty/ | devicon-lookup --color --prefix :
 vendor/smarty/smarty/demo/plugins/resource.extendsall.php:4:4: * Extends All Resource:4:4: * Extends All Resource
 vendor/smarty/smarty/demo/plugins/resource.extendsall.php:11:23:class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends:11:23:class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends

while the expected result should be

 vendor/smarty/smarty/demo/plugins/resource.extendsall.php:4:4: * Extends All Resource
 vendor/smarty/smarty/demo/plugins/resource.extendsall.php:11:23:class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends

I've added a test and a simple test to fix the problem.

shadowwa avatar Oct 11 '24 11:10 shadowwa