Revert the whitespace "fix"
There was already a feature, Field.KeepSpaces, for the programmer to control this. The new strip-only-trailing-spaces behavior was inconsistent with the original design.
This commit is contained in:
1 parent
5f2d7355e4
commit
7b5603eb11
1 file changed
+3
-4
@@ -163,14 +163,13 @@ func ShowScreenOpts(screen Screen, values map[string]string, conn net.Conn,
|
|||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip trailing spaces from field values. Most applications will
|
// Strip spaces from field values unless the caller requested that we
|
||||||
// want to strip leading spaces, too, but it's possible they want them
|
// maintain whitespace.
|
||||||
// preserved, so we'll leave that to the caller.
|
|
||||||
for _, fld := range screen {
|
for _, fld := range screen {
|
||||||
if !fld.KeepSpaces {
|
if !fld.KeepSpaces {
|
||||||
if _, ok := resp.Values[fld.Name]; ok {
|
if _, ok := resp.Values[fld.Name]; ok {
|
||||||
resp.Values[fld.Name] =
|
resp.Values[fld.Name] =
|
||||||
strings.TrimRight(resp.Values[fld.Name], " ")
|
strings.TrimSpace(resp.Values[fld.Name])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user