For example, I have this string for Text
: Incoming event 0 111
.(There are two tab spaces between 0 and 111.)
When there is enough width space to show it,it is fine.
But if there isn't enough width space to show it in a single line, it wraps into two lines,and the tab spaces disappear magically(At least one of the tab spaces does,if not both of them).
Is this a bug or did I miss something?
CodePudding user response:
It works fine if you code tab as \t
in the string. Otherwise the tab key is translated into spaces, which will sometimes be ignored in line breaking.
VStack(alignment: .leading, spacing: 30) {
Text("Incoming event 0\t\t111")
.frame(width: 300, alignment: .leading)
.border(.red)
Text("Incoming event 0\t\t111")
.frame(width: 150, alignment: .leading)
.border(.red)
}
CodePudding user response:
I did a quick check with user input and to me it seems like it's working fine ... isn't that the behavior you want?
TextField("Input", text: $input)
Text(input)
.frame(width: 300, alignment: .leading)
.border(.red)
Text(input)
.frame(width: 150, alignment: .leading)
.border(.red)