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

Stack cells #7

Open
aspyatkin opened this issue May 14, 2015 · 8 comments
Open

Stack cells #7

aspyatkin opened this issue May 14, 2015 · 8 comments

Comments

@aspyatkin
Copy link

I suppose cells should be stacked when terminal width is not sufficient for 4 cells of each day. Now in my terminal with 90 symbols width the output is a real mess.
notstacked

@schachmat
Copy link
Owner

Correct, that is a problem. I have not researched how to reliably and portably detect terminal width in go yet. If you have some hints/ideas, let me know.

@schachmat schachmat added the bug label May 14, 2015
@certifiedloud
Copy link

+1

@BrandonRomano
Copy link

@schachmat, here's a quick program showing how you can detect terminal width.

You might have to run go get golang.org/x/crypto/ssh/terminal before running if you haven't already got this installed.

package main

import (
    "fmt"
    "golang.org/x/crypto/ssh/terminal"
)

func main() {
    width, _, _ := terminal.GetSize(0)
    fmt.Println("Width:", width)
}

Outputs for me:

Width: 159

@philadams-zz
Copy link

👍

@pavel-main
Copy link

@schachmat Take a look at this package - tablewriter

@schachmat
Copy link
Owner

tablewriter does not seem to support correct connections for the vertical and horizontal lines. Also embedding the date between the „Noon“ and „Evening“ columns can't be done.

@giuscri
Copy link

giuscri commented May 25, 2015

Apparently you can elegantly solve the problem using the core package syscall and doing an ioctl — but check the parameters you pass, to truly achieve portability among Windows, Linux and OSX (the last two ones behave differently in this case).

Check here

http://stackoverflow.com/a/16576712/2219670

and here

http://unix.stackexchange.com/a/93174/47999

@philcali
Copy link

I don't know how compatible the renderings are, but you might be able to accomplish this with TermUI?

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

No branches or pull requests

9 participants