yorukot / superfile

Pretty fancy and modern terminal file manager
https://superfile.netlify.app
MIT License
7.67k stars 172 forks source link

Double ANSI escape not rendering correctly in some terminals (kitty) #449

Open Pistonight opened 2 weeks ago

Pistonight commented 2 weeks ago

Describe the bug String manipulation for menus sometimes produces 2 \x1b next to each other. Some terminals break

To Reproduce

I was able to debug by adding a hack here before the return: https://github.com/yorukot/superfile/blob/cc50cd630404d4d7e23e325af87e978cc3548129/src/pkg/string_function/overplace.go#L100-L113

 output := b.String()
  os.WriteFile("/tmp/temp.out", []byte(output), 0666)
return output
 //return b.String() 

Steps to reproduce the behavior:

  1. Build with the above hack
  2. Open "Sort Options"
  3. Close Program
  4. Open the dumped output in a hex editor, Search for the byte sequence 1B 1B

Expected behavior No occurrence of the byte sequence 1B 1B

Screenshots I have not figured out how to screenshot on my system (sorry), but basically, kitty does not like the double \x1b, and renders something like:

Sort Options          [0m|

System information (please complete the following information):