@@ -37,7 +37,6 @@ type linePair struct {
3737 newLineNum int
3838}
3939
40- // renderEditFile renders edit_file tool arguments
4140func renderEditFile (toolCall tools.ToolCall , width int , splitView bool , toolStatus types.ToolStatus ) string {
4241 var args builtin.EditFileArgs
4342 if err := json .Unmarshal ([]byte (toolCall .Function .Arguments ), & args ); err != nil {
@@ -65,9 +64,6 @@ func renderEditFile(toolCall tools.ToolCall, width int, splitView bool, toolStat
6564 return output .String ()
6665}
6766
68- // computeDiff computes a diff between old and new text
69- // For confirmation status: reads current file (old) and applies edit to get new content
70- // For result status: reads current file (new) and reconstructs old content by reversing the edit
7167func computeDiff (path , oldText , newText string , toolStatus types.ToolStatus ) []* udiff.Hunk {
7268 currentContent , err := os .ReadFile (path )
7369 if err != nil {
@@ -130,7 +126,6 @@ func normalizeDiff(diff []*udiff.Hunk) []*udiff.Hunk {
130126 return diff
131127}
132128
133- // syntaxHighlight applies syntax highlighting to code and returns styled text
134129func syntaxHighlight (code , filePath string ) []chromaToken {
135130 lexer := lexers .Match (filePath )
136131 if lexer == nil {
@@ -178,7 +173,6 @@ func chromaToLipgloss(tokenType chroma.TokenType, style *chroma.Style) lipgloss.
178173 return lipStyle
179174}
180175
181- // renderDiffWithSyntaxHighlight renders a unified diff view
182176func renderDiffWithSyntaxHighlight (diff []* udiff.Hunk , filePath string , width int ) string {
183177 var output strings.Builder
184178 contentWidth := width - lineNumWidth
@@ -201,7 +195,6 @@ func renderDiffWithSyntaxHighlight(diff []*udiff.Hunk, filePath string, width in
201195 return strings .TrimSuffix (output .String (), "\n " )
202196}
203197
204- // renderSplitDiffWithSyntaxHighlight renders a split diff view with old/new side-by-side
205198func renderSplitDiffWithSyntaxHighlight (diff []* udiff.Hunk , filePath string , width int ) string {
206199 // Fall back to unified diff if terminal is too narrow
207200 separator := styles .SeparatorStyle .Render (" │ " )
@@ -229,7 +222,6 @@ func renderSplitDiffWithSyntaxHighlight(diff []*udiff.Hunk, filePath string, wid
229222 return strings .TrimSuffix (output .String (), "\n " )
230223}
231224
232- // getDisplayLineNumber returns the appropriate line number and updates counters
233225func getDisplayLineNumber (line * udiff.Line , oldLineNum , newLineNum * int ) int {
234226 switch line .Kind {
235227 case udiff .Delete :
@@ -249,7 +241,6 @@ func getDisplayLineNumber(line *udiff.Line, oldLineNum, newLineNum *int) int {
249241 return 0
250242}
251243
252- // prepareContent normalizes content for display
253244func prepareContent (content string , maxWidth int ) string {
254245 content = strings .ReplaceAll (content , "\t " , strings .Repeat (" " , tabWidth ))
255246 content = strings .TrimRight (content , "\n " )
@@ -259,7 +250,6 @@ func prepareContent(content string, maxWidth int) string {
259250 return content
260251}
261252
262- // renderLine renders a line with syntax highlighting and appropriate styling
263253func renderLine (content string , kind udiff.OpKind , filePath string , width int ) string {
264254 tokens := syntaxHighlight (content , filePath )
265255 lineStyle := getLineStyle (kind )
@@ -269,7 +259,6 @@ func renderLine(content string, kind udiff.OpKind, filePath string, width int) s
269259 return padToWidth (rendered , width , lineStyle )
270260}
271261
272- // renderSplitSide renders one side of a split diff
273262func renderSplitSide (line * udiff.Line , lineNum int , filePath string , width int ) string {
274263 lineNumStr := formatLineNum (line , lineNum )
275264
@@ -284,7 +273,6 @@ func renderSplitSide(line *udiff.Line, lineNum int, filePath string, width int)
284273 return styles .LineNumberStyle .Render (lineNumStr ) + styledContent
285274}
286275
287- // renderTokensWithStyle applies consistent styling to tokens
288276func renderTokensWithStyle (tokens []chromaToken , lineStyle lipgloss.Style ) string {
289277 var output strings.Builder
290278
@@ -296,7 +284,6 @@ func renderTokensWithStyle(tokens []chromaToken, lineStyle lipgloss.Style) strin
296284 return output .String ()
297285}
298286
299- // padToWidth adds padding to reach the desired width
300287func padToWidth (content string , width int , style lipgloss.Style ) string {
301288 currentWidth := ansi .StringWidth (content )
302289 if paddingNeeded := width - currentWidth ; paddingNeeded > 0 {
@@ -306,7 +293,6 @@ func padToWidth(content string, width int, style lipgloss.Style) string {
306293 return content
307294}
308295
309- // ensureWidth ensures a line has consistent width
310296func ensureWidth (line string , width int ) string {
311297 if lineWidth := ansi .StringWidth (line ); lineWidth < width {
312298 padding := styles .DiffUnchangedStyle .Render (strings .Repeat (" " , width - lineWidth ))
@@ -315,7 +301,6 @@ func ensureWidth(line string, width int) string {
315301 return line
316302}
317303
318- // getLineStyle returns the style for a diff line type
319304func getLineStyle (kind udiff.OpKind ) lipgloss.Style {
320305 switch kind {
321306 case udiff .Delete :
@@ -327,15 +312,13 @@ func getLineStyle(kind udiff.OpKind) lipgloss.Style {
327312 }
328313}
329314
330- // formatLineNum formats a line number or returns empty space
331315func formatLineNum (line * udiff.Line , lineNum int ) string {
332316 if line == nil {
333317 return strings .Repeat (" " , lineNumWidth )
334318 }
335319 return fmt .Sprintf ("%4d " , lineNum )
336320}
337321
338- // pairDiffLines pairs old and new lines for split view rendering
339322func pairDiffLines (lines []udiff.Line , fromLine , toLine int ) []linePair {
340323 var pairs []linePair
341324 oldLineNum , newLineNum := fromLine , toLine
0 commit comments