pane.go: strings.Cut, not a hand-rolled cut
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+3
−13
internal/fichas/pane.go+3 −13
diff --git a/internal/fichas/pane.go b/internal/fichas/pane.go| index 2d0b351..9992b05 100644 |
| --- a/internal/fichas/pane.go |
| +++ b/internal/fichas/pane.go |
| @@ -6,6 +6,7 @@ package fichas |
| import ( |
| "net/http" |
| + "strings" |
| "strconv" |
| "time" |
| ) |
| @@ -74,19 +75,8 @@ func (a *app) listData(r *http.Request, l listState, res Result, fields []FieldV |
| func listQuery(l listState) string { |
| l.Card, l.Page = 0, 0 |
| h := l.href() |
| - if _, q, ok := cut(h, "?"); ok { |
| - return q |
| - } |
| - return "" |
| -} |
| - |
| -func cut(s, sep string) (string, string, bool) { |
| - for i := 0; i+len(sep) <= len(s); i++ { |
| - if s[i:i+len(sep)] == sep { |
| - return s[:i], s[i+len(sep):], true |
| - } |
| - } |
| - return s, "", false |
| + _, q, _ := strings.Cut(h, "?") |
| + return q |
| } |
| // OpenHref is this list with a card open beside it. |