Skip to content

automatically calculate the width of the console #276

Answered by bashbunni
pheninux asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @pheninux,

That would just require that you handle tea.WindowSizeMsg in your model's Update function.

	case tea.WindowSizeMsg:
		m.width = msg.Width
		return m, nil

You would set your new width in the block of code and after Update, View will be called to redraw your model. It's in View that it will redraw your model based on the updated terminal width. I hope that helps!

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@pheninux
Comment options

@bashbunni
Comment options

@pheninux
Comment options

@pheninux
Comment options

Answer selected by bashbunni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants