Skip to content

Setting a border around a list results in "breaks" when scrolling the list #240

Answered by meowgorithm
er4hn asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! This is because the style you're applying is causing the list to run higher than the vertical height of the terminal. To fix it we need to change the code that measures the margins to instead measure all the vertical space that's being taken up by the margins, borders and padding. There's a Lip Gloss style method for this called GetFrameSize.

So just change lines 38 and 39 to:

v, h := docStyle.GetFrameSize()
m.list.SetSize(msg.Width-h, msg.Height-v)

Here's a patch:

diff --git a/examples/list-default/main.go b/examples/list-default/main.go
index e7b1d6b..73c84a4 100644
--- a/examples/list-default/main.go
+++ b/examples/list-default/main.go
@@ -9,7 +9,7 @@ import (
 	"github.com/charmbr…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by muesli
Comment options

You must be logged in to vote
0 replies
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
Converted from issue

This discussion was converted from issue #239 on February 22, 2022 05:13.