Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Pistonight opened this issue Nov 10, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Pistonight
Copy link

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:

b.WriteString(fgLine)
pos += ansi.PrintableRuneWidth(fgLine)
right := cutLeft(bgLine, pos)
bgWidth := ansi.PrintableRuneWidth(bgLine)
rightWidth := ansi.PrintableRuneWidth(right)
if rightWidth <= bgWidth-pos {
b.WriteString(ws.render(bgWidth - rightWidth - pos))
}
b.WriteString(right)
}
return b.String()

 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 Pistonight added the bug Something isn't working label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant