Browse Source

Modernize min/max usage in permission dialog

- 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 <[email protected]>
Kujtim Hoxha 10 months ago
parent
commit
fa5840cf75
1 changed files with 2 additions and 6 deletions
  1. 2 6
      internal/tui/components/dialog/permission.go

+ 2 - 6
internal/tui/components/dialog/permission.go

@@ -199,12 +199,8 @@ func (p *permissionDialogCmp) render() string {
 		
 		
 		// Add some padding to the content lines
 		// Add some padding to the content lines
 		contentHeight := contentLines + 2
 		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.Height = contentHeight
 		
 		
 		p.contentViewPort.SetContent(renderedContent)
 		p.contentViewPort.SetContent(renderedContent)