chore: some cleanup

Kujtim Hoxha created

Change summary

internal/ui/chat/agent.go         | 16 ++++------------
internal/ui/chat/tools.go         |  8 ++++----
internal/ui/dialog/models_list.go | 18 +++++++++---------
internal/ui/styles/styles.go      |  6 ++++++
4 files changed, 23 insertions(+), 25 deletions(-)

Detailed changes

internal/ui/chat/agent.go 🔗

@@ -120,7 +120,7 @@ func (r *AgentToolRenderContext) RenderTool(sty *styles.Styles, width int, opts
 	taskTagWidth := lipgloss.Width(taskTag)
 
 	// Calculate remaining width for prompt.
-	remainingWidth := min(cappedWidth-taskTagWidth-3, 120-taskTagWidth-3) // -3 for spacing
+	remainingWidth := min(cappedWidth-taskTagWidth-3, maxTextWidth-taskTagWidth-3) // -3 for spacing
 
 	promptText := sty.Tool.AgentPrompt.Width(remainingWidth).Render(prompt)
 
@@ -253,21 +253,13 @@ func (r *AgenticFetchToolRenderContext) RenderTool(sty *styles.Styles, width int
 	}
 
 	// Build the prompt tag.
-	promptTag := sty.Base.Bold(true).
-		Padding(0, 1).
-		MarginLeft(2).
-		Background(sty.Green).
-		Foreground(sty.Border).
-		Render("Prompt")
+	promptTag := sty.Tool.AgenticFetchPromptTag.Render("Prompt")
 	promptTagWidth := lipgloss.Width(promptTag)
 
 	// Calculate remaining width for prompt text.
-	remainingWidth := cappedWidth - promptTagWidth - 3 // -3 for spacing
-	if remainingWidth > 120-promptTagWidth-3 {
-		remainingWidth = 120 - promptTagWidth - 3
-	}
+	remainingWidth := min(cappedWidth-promptTagWidth-3, maxTextWidth-promptTagWidth-3) // -3 for spacing
 
-	promptText := sty.Base.Width(remainingWidth).Render(prompt)
+	promptText := sty.Tool.AgentPrompt.Width(remainingWidth).Render(prompt)
 
 	header = lipgloss.JoinVertical(
 		lipgloss.Left,

internal/ui/chat/tools.go 🔗

@@ -634,7 +634,7 @@ func toolOutputDiffContent(sty *styles.Styles, file, oldContent, newContent stri
 		Width(bodyWidth)
 
 	// Use split view for wide terminals.
-	if width > 120 {
+	if width > maxTextWidth {
 		formatter = formatter.Split()
 	}
 
@@ -684,7 +684,7 @@ func toolOutputMultiEditDiffContent(sty *styles.Styles, file string, meta tools.
 		Width(bodyWidth)
 
 	// Use split view for wide terminals.
-	if width > 120 {
+	if width > maxTextWidth {
 		formatter = formatter.Split()
 	}
 
@@ -740,8 +740,8 @@ func toolOutputMarkdownContent(sty *styles.Styles, content string, width int, ex
 	content = strings.TrimSpace(content)
 
 	// Cap width for readability.
-	if width > 120 {
-		width = 120
+	if width > maxTextWidth {
+		width = maxTextWidth
 	}
 
 	renderer := common.PlainMarkdownRenderer(sty, width)

internal/ui/dialog/models_list.go 🔗

@@ -68,7 +68,7 @@ func (f *ModelsList) SetSelected(index int) {
 
 	f.List.SetSelected(index)
 	for {
-		selectedItem := f.List.SelectedItem()
+		selectedItem := f.SelectedItem()
 		if _, ok := selectedItem.(*ModelItem); ok {
 			return
 		}
@@ -104,7 +104,7 @@ func (f *ModelsList) SetSelectedItem(itemID string) {
 func (f *ModelsList) SelectNext() (v bool) {
 	for {
 		v = f.List.SelectNext()
-		selectedItem := f.List.SelectedItem()
+		selectedItem := f.SelectedItem()
 		if _, ok := selectedItem.(*ModelItem); ok {
 			return v
 		}
@@ -116,7 +116,7 @@ func (f *ModelsList) SelectNext() (v bool) {
 func (f *ModelsList) SelectPrev() (v bool) {
 	for {
 		v = f.List.SelectPrev()
-		selectedItem := f.List.SelectedItem()
+		selectedItem := f.SelectedItem()
 		if _, ok := selectedItem.(*ModelItem); ok {
 			return v
 		}
@@ -127,7 +127,7 @@ func (f *ModelsList) SelectPrev() (v bool) {
 func (f *ModelsList) SelectFirst() (v bool) {
 	v = f.List.SelectFirst()
 	for {
-		selectedItem := f.List.SelectedItem()
+		selectedItem := f.SelectedItem()
 		if _, ok := selectedItem.(*ModelItem); ok {
 			return v
 		}
@@ -139,7 +139,7 @@ func (f *ModelsList) SelectFirst() (v bool) {
 func (f *ModelsList) SelectLast() (v bool) {
 	v = f.List.SelectLast()
 	for {
-		selectedItem := f.List.SelectedItem()
+		selectedItem := f.SelectedItem()
 		if _, ok := selectedItem.(*ModelItem); ok {
 			return v
 		}
@@ -149,18 +149,18 @@ func (f *ModelsList) SelectLast() (v bool) {
 
 // IsSelectedFirst checks if the selected item is the first model item.
 func (f *ModelsList) IsSelectedFirst() bool {
-	originalIndex := f.List.Selected()
+	originalIndex := f.Selected()
 	f.SelectFirst()
-	isFirst := f.List.Selected() == originalIndex
+	isFirst := f.Selected() == originalIndex
 	f.List.SetSelected(originalIndex)
 	return isFirst
 }
 
 // IsSelectedLast checks if the selected item is the last model item.
 func (f *ModelsList) IsSelectedLast() bool {
-	originalIndex := f.List.Selected()
+	originalIndex := f.Selected()
 	f.SelectLast()
-	isLast := f.List.Selected() == originalIndex
+	isLast := f.Selected() == originalIndex
 	f.List.SetSelected(originalIndex)
 	return isLast
 }

internal/ui/styles/styles.go 🔗

@@ -279,6 +279,9 @@ type Styles struct {
 		AgentTaskTag lipgloss.Style // Agent task tag (blue background, bold)
 		AgentPrompt  lipgloss.Style // Agent prompt text
 
+		// Agentic fetch styles
+		AgenticFetchPromptTag lipgloss.Style // Agentic fetch prompt tag (green background, bold)
+
 		// Todo styles
 		TodoRatio          lipgloss.Style // Todo ratio (e.g., "2/5")
 		TodoCompletedIcon  lipgloss.Style // Completed todo icon
@@ -1012,6 +1015,9 @@ func DefaultStyles() Styles {
 	s.Tool.AgentTaskTag = base.Bold(true).Padding(0, 1).MarginLeft(2).Background(blueLight).Foreground(white)
 	s.Tool.AgentPrompt = s.Muted
 
+	// Agentic fetch styles
+	s.Tool.AgenticFetchPromptTag = base.Bold(true).Padding(0, 1).MarginLeft(2).Background(green).Foreground(border)
+
 	// Todo styles
 	s.Tool.TodoRatio = base.Foreground(blueDark)
 	s.Tool.TodoCompletedIcon = base.Foreground(green)