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

Dynamically adjust the column widths #813

Merged
merged 1 commit into from
Jun 9, 2024

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented Jun 9, 2024

Instead of assuming each column has the width of the text 88:88:88, we now determine the largest string per column (based on unicode scalar values) and adjust the column width accordingly. There is still a fixed minimum width based on the string 88:88, which ensures that the columns don't switch sizes too often, especially if you start with empty splits. We could've also chosen 8:88:88, which would ensure there's no column size change as you approach the hour mark. However, this would increase the size of delta columns unnecessarily. So it's a little bit of a trade-off.

Before:

image

After:

chrome_1nPPALGqbb.mp4

Instead of assuming each column has the width of the text `88:88:88`, we
now determine the largest string per column (based on unicode scalar
values) and adjust the column width accordingly. There is still a fixed
minimum width based on the string `88:88`, which ensures that the
columns don't switch sizes too often, especially if you start with empty
splits. We could've also chosen `8:88:88`, which would ensure there's no
column size change as you approach the hour mark. However, this would
increase the size of delta columns unnecessarily. So it's a little bit
of a trade-off.
@CryZe CryZe added bug There is a bug. enhancement An improvement for livesplit-core. rendering The issue or pull request is affecting the rendering. feature A new user visible feature for livesplit-core. labels Jun 9, 2024
@CryZe CryZe added this to the v0.14 milestone Jun 9, 2024
@CryZe CryZe requested a review from wooferzfg June 9, 2024 13:05
@CryZe
Copy link
Collaborator Author

CryZe commented Jun 9, 2024

The tests changed, because the deltas are now often closer to the split time column.

@CryZe
Copy link
Collaborator Author

CryZe commented Jun 9, 2024

@wooferzfg I don't really want a code review, but more of a review of the concept, that we look for the largest string per column, but use 88:88 as the minimum size.

@CryZe CryZe merged commit 334e37d into LiveSplit:master Jun 9, 2024
70 checks passed
@CryZe CryZe deleted the dynamic-column-widths branch June 9, 2024 15:54
AlexKnauth pushed a commit to AlexKnauth/livesplit-core that referenced this pull request Jun 13, 2024
Instead of assuming each column has the width of the text `88:88:88`, we
now determine the largest string per column (based on unicode scalar
values) and adjust the column width accordingly. There is still a fixed
minimum width based on the string `88:88`, which ensures that the
columns don't switch sizes too often, especially if you start with empty
splits. We could've also chosen `8:88:88`, which would ensure there's no
column size change as you approach the hour mark. However, this would
increase the size of delta columns unnecessarily. So it's a little bit
of a trade-off.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug There is a bug. enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. rendering The issue or pull request is affecting the rendering.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant