superfile icon indicating copy to clipboard operation
superfile copied to clipboard

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

Open Pistonight opened this issue 3 months ago • 0 comments

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: 0. Build with the above hack

  1. Open "Sort Options"
  2. Close Program
  3. 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):

  • OS: Arch Linux 6.11.6-arch1-1
  • Superfile Version 1.1.5

Pistonight avatar Nov 10 '24 22:11 Pistonight