Closed ewilken closed 1 year ago
There is a setting on the terminal that you can set that will turn new line into new line + cr.
You can change this configuration at startup with the TerminalOptions.convertEol
, or at runtime with an escape sequence:
https://vt100.net/docs/vt510-rm/DECRQM.html
(You want code 20: LNM)
Thank you so much! 😊
Describe the bug
This might very well be a bug in my code, but in that case, (not being an expert in the domain of how terminals work) I would be really thankful for some hint in a right direction, since I saw you helping out a lot of people in other issues super nicely and concise. Thank you in advance for that!
So I'm using SwiftTerm for my SwiftUI Kubernetes management app to implement the behaviors of
kubectl exec
andkubectl attach
.For exec, I'm executing a shell command (e.g.
/bin/sh
) in a container that allocates a TTY and wire stdin and stdout to SwiftTerm'ssend
andfeed
, which works like a charm. I get a prompt, can type to the stdin, and even resizing works nicely.For attach though, Kubernetes attaches to the main process running inside a container, which might not necessarily allocate a TTY, but usually accepts stdin and spits out stdout and stderr byte streams. So far so good. When I wire e.g. a pod's stdout to SwiftTerm though, stdout lines ending with a
0x0a
byte are rendering the next line after the break inset to where the previous line ended (see screenshot below). I have no explanation for this, but maybe there's an easy one with a little more knowledge about terminal internals. 😅To Reproduce
Attach SwiftTerm to the stdout of a Kubernetes pod that doesn't allocate a TTY and watch newlines being rendered inset.
Expected behavior
The terminal view rendering new lines left-aligned with no inset.
Screenshots
I tried taking a screenshot while logging the bytes I was feeding into SwiftTerm.
The terminal looks like this:
while being fed:
So every line seems to end with a
0x0a
line feed for what it's worth.Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
I can't thank you enough for this library! Thanks a lot for all the work you've done here and thanks a lot in advance for any hint you might have about my bug!