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

text/tabwriter: elide trailing padding when last cell is empty #5994

Open
cloneable opened this issue Jul 30, 2013 · 8 comments
Open

text/tabwriter: elide trailing padding when last cell is empty #5994

cloneable opened this issue Jul 30, 2013 · 8 comments
Milestone

Comments

@cloneable
Copy link

I would like to suggest a new switch for tabwriter that makes it discard trailing
padding bytes when all subsequent cells on that line are empty.

See example below. The third column is only filled in the first line. It's not possible
to align that cell right of the second column without having extra padding on the second
line.

http://play.golang.org/p/lW5-7CFrNC

package main

import (
    "fmt"
    "os"
    "text/tabwriter"
)

func main() {
    w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, '*', 0)
    fmt.Fprintln(w, "x\tx\tx")
    fmt.Fprintln(w, "aaaa\tbbb")
    w.Flush()
    fmt.Fprintln(w, "x\tx\tx")
    fmt.Fprintln(w, "aaaa\tbbb\t")
    w.Flush()
}


x****x*x
aaaa*bbb
x****x***x
aaaa*bbb*

(Obviously, this is much more useful for trailing whitespace.)
@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 2:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 3:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 29, 2013

Comment 4:

Not for 1.2.

Labels changed: removed go1.2maybe.

@griesemer
Copy link
Contributor

Comment 5:

Owner changed to @griesemer.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 6:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 7:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added repo-main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants