on main help sign in
chore: run `modernize`
5e23ecdAndrey Nering
internal/agent/tools/search.go+2−2
@@ -172,8 +172,8 @@ func getTextContent(n *html.Node) string {
172
172
173func cleanDuckDuckGoURL(rawURL string) string {
173func cleanDuckDuckGoURL(rawURL string) string {
174 if strings.HasPrefix(rawURL, "//duckduckgo.com/l/?uddg=") {
174 if strings.HasPrefix(rawURL, "//duckduckgo.com/l/?uddg=") {
175− if idx := strings.Index(rawURL, "uddg="); idx != -1 {
175+ if _, after, ok := strings.Cut(rawURL, "uddg="); ok {
176− encoded := rawURL[idx+5:]
176+ encoded := after
177 if ampIdx := strings.Index(encoded, "&"); ampIdx != -1 {
177 if ampIdx := strings.Index(encoded, "&"); ampIdx != -1 {
178 encoded = encoded[:ampIdx]
178 encoded = encoded[:ampIdx]
179 }
179 }
internal/config/config.go+2−2
@@ -350,7 +350,7 @@ type Agent struct {
350}
350}
351
351
352type Tools struct {
352type Tools struct {
353− Ls ToolLs `json:"ls,omitempty"`
353+ Ls ToolLs `json:"ls"`
354}
354}
355
355
356type ToolLs struct {
356type ToolLs struct {
@@ -383,7 +383,7 @@ type Config struct {
383
383
384 Permissions *Permissions `json:"permissions,omitempty" jsonschema:"description=Permission settings for tool usage"`
384 Permissions *Permissions `json:"permissions,omitempty" jsonschema:"description=Permission settings for tool usage"`
385
385
386− Tools Tools `json:"tools,omitempty" jsonschema:"description=Tool configurations"`
386+ Tools Tools `json:"tools" jsonschema:"description=Tool configurations"`
387
387
388 Agents map[string]Agent `json:"-"`
388 Agents map[string]Agent `json:"-"`
389
389
internal/csync/value_test.go+2−4
@@ -83,11 +83,9 @@ func TestValue_ConcurrentAccess(t *testing.T) {
83
83
84 // Concurrent readers.
84 // Concurrent readers.
85 for range 100 {
85 for range 100 {
86− wg.Add(1)
87− go func() {
86+ wg.Go(func() {
88− defer wg.Done()
89 _ = v.Get()
87 _ = v.Get()
90− }()
88+ })
91 }
89 }
92
90
93 wg.Wait()
91 wg.Wait()
internal/shell/shell.go+2−2
@@ -207,8 +207,8 @@ func splitArgsFlags(parts []string) (args []string, flags []string) {
207 if strings.HasPrefix(part, "-") {
207 if strings.HasPrefix(part, "-") {
208 // Extract flag name before '=' if present
208 // Extract flag name before '=' if present
209 flag := part
209 flag := part
210− if idx := strings.IndexByte(part, '='); idx != -1 {
210+ if before, _, ok := strings.Cut(part, "="); ok {
211− flag = part[:idx]
211+ flag = before
212 }
212 }
213 flags = append(flags, flag)
213 flags = append(flags, flag)
214 } else {
214 } else {
internal/ui/model/chat.go+1−4
@@ -745,10 +745,7 @@ func (m *Chat) selectWord(itemIdx, x, itemY int) {
745 // Adjust x for the item's left padding (border + padding) to get content column.
745 // Adjust x for the item's left padding (border + padding) to get content column.
746 // The mouse x is in viewport space, but we need content space for boundary detection.
746 // The mouse x is in viewport space, but we need content space for boundary detection.
747 offset := chat.MessageLeftPaddingTotal
747 offset := chat.MessageLeftPaddingTotal
748− contentX := x - offset
748+ contentX := max(x-offset, 0)
749− if contentX < 0 {
750− contentX = 0
751− }
752
749
753 line := ansi.Strip(lines[itemY])
750 line := ansi.Strip(lines[itemY])
754 startCol, endCol := findWordBoundaries(line, contentX)
751 startCol, endCol := findWordBoundaries(line, contentX)