Modernize min/max usage in permission dialog
Kujtim Hoxha
and
termai
created 7 months ago
- Replace if statements with direct min/max function calls
- Fix linter hint about using modern min/max functions
- Simplify code for better readability
🤖 Generated with termai
Co-Authored-By: termai <noreply@termai.io>
Change summary
internal/tui/components/dialog/permission.go | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
Detailed changes
@@ -199,12 +199,8 @@ func (p *permissionDialogCmp) render() string {
// Add some padding to the content lines
contentHeight := contentLines + 2
- if contentHeight < minContentHeight {
- contentHeight = minContentHeight
- }
- if contentHeight > maxContentHeight {
- contentHeight = maxContentHeight
- }
+ contentHeight = max(contentHeight, minContentHeight)
+ contentHeight = min(contentHeight, maxContentHeight)
p.contentViewPort.Height = contentHeight
p.contentViewPort.SetContent(renderedContent)