Procházet zdrojové kódy

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 před 1 rokem
rodič
revize
fa5840cf75
1 změnil soubory, kde provedl 2 přidání a 6 odebrání
  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
 		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)