fix: use actual terminal height for scroll instead of hardcoded value#47
Merged
abhixdd merged 2 commits intoabhixdd:mainfrom Apr 2, 2026
Merged
Conversation
O adjust_scroll usava visible_height = 10 hardcoded, o que causava problemas em terminais de diferentes tamanhos: - Terminais pequenos: cursor podia ficar fora da área visível - Terminais grandes: scroll ficava restrito a janela de 10 linhas mesmo com espaço disponível Agora terminal_height é atualizado a cada frame via f.size() e adjust_scroll calcula a altura visível descontando o chrome da UI (breadcrumb, bordas, header, help bar).
Owner
|
@LuisMIguelFurlanettoSousa Looks good overall, but one issue before merge: scroll height is still hardcoded, so when search/download bars show up, cursor and scroll can get out of sync. Please make |
adjust_scroll now dynamically adds +2 for download status bar and +3 for search bar when they are visible, instead of using a fixed chrome_height of 8. This prevents cursor/scroll desync when those bars appear or disappear.
Contributor
Author
|
@abhixdd Fixed! let mut chrome_height: u16 = 8; // base: breadcrumb + borders + header + help
if self.downloading {
chrome_height += 2; // download status bar
}
if self.is_searching {
chrome_height += 3; // search bar with borders
}This matches the exact |
Owner
|
@LuisMIguelFurlanettoSousa Thanks for the fix. LGTM! Merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #46
The scroll calculation now uses the actual terminal height instead of a hardcoded
visible_height = 10.Changes
terminal_height: u16field toAppState(default: 24)terminal_heightfromf.size().heighteach frameadjust_scrollnow calculates visible height by subtracting UI chrome (breadcrumb, borders, header row, help bar ≈ 8 lines) from the actual terminal heightBefore
All terminals → scroll window fixed at 10 lines
After
Terminal with 24 rows → ~16 visible lines
Terminal with 50 rows → ~42 visible lines
Terminal with 12 rows → ~4 visible lines (gracefully handles small terminals)