-
hello , how to automatically calculate the width of the console. I want to display data in the center and when I change the width of the console the data remains in the center? can you help me please |
Beta Was this translation helpful? Give feedback.
Answered by
bashbunni
Apr 3, 2022
Replies: 1 comment 4 replies
-
Hey @pheninux, That would just require that you handle case tea.WindowSizeMsg:
m.width = msg.Width
return m, nil You would set your new width in the block of code and after |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
bashbunni
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @pheninux,
That would just require that you handle
tea.WindowSizeMsg
in your model'sUpdate
function.You would set your new width in the block of code and after
Update
,View
will be called to redraw your model. It's inView
that it will redraw your model based on the updated terminal width. I hope that helps!