fix: resolve lint issues (line length, magic number, unused field)
- commit
- 8ba02282ece0e90fd1a8f9ad6dacb5d3683b3c80
- author
- brice · · 2026-01-01 13:51 UTC
- parent
- c9e4be8
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +10 -3
M internal/infrastructure/webkit/handlers/clipboard.go +7 -1
| @@ -71,7 +71,13 @@ func (h *ClipboardHandler) HandleAutoCopySelection() webkit.MessageHandler { | |||
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | 73 | // RegisterClipboardHandlers registers clipboard handlers with the router. | |
| 74 | - | func RegisterClipboardHandlers(ctx context.Context, router *webkit.MessageRouter, clipboard port.Clipboard, configGetter func() *config.Config, onCopied func(textLen int)) error { | |
| 74 | + | func RegisterClipboardHandlers( | |
| 75 | + | ctx context.Context, | |
| 76 | + | router *webkit.MessageRouter, | |
| 77 | + | clipboard port.Clipboard, | |
| 78 | + | configGetter func() *config.Config, | |
| 79 | + | onCopied func(textLen int), | |
| 80 | + | ) error { | |
| 75 | 81 | handler := NewClipboardHandler(clipboard, configGetter, onCopied) | |
| 76 | 82 | ||
| 77 | 83 | // Register auto_copy_selection handler | |
| @@ -71,7 +71,13 @@ func (h *ClipboardHandler) HandleAutoCopySelection() webkit.MessageHandler { | |||||
| 71 | } | 71 | } | ||
| 72 | 72 | ||||
| 73 | // RegisterClipboardHandlers registers clipboard handlers with the router. | 73 | // RegisterClipboardHandlers registers clipboard handlers with the router. | ||
| 74 | - | func RegisterClipboardHandlers(ctx context.Context, router *webkit.MessageRouter, clipboard port.Clipboard, configGetter func() *config.Config, onCopied func(textLen int)) error { | 74 | + | func RegisterClipboardHandlers( |
| 75 | + | ctx context.Context, | |||
| 76 | + | router *webkit.MessageRouter, | |||
| 77 | + | clipboard port.Clipboard, | |||
| 78 | + | configGetter func() *config.Config, | |||
| 79 | + | onCopied func(textLen int), | |||
| 80 | + | ) error { | |||
| 75 | handler := NewClipboardHandler(clipboard, configGetter, onCopied) | 81 | handler := NewClipboardHandler(clipboard, configGetter, onCopied) | ||
| 76 | 82 | ||||
| 77 | // Register auto_copy_selection handler | 83 | // Register auto_copy_selection handler | ||
M internal/infrastructure/webkit/injector.go +0 -1
| @@ -150,7 +150,6 @@ type ContentInjector struct { | |||
| 150 | 150 | colorResolver port.ColorSchemeResolver | |
| 151 | 151 | themeCSSVars string // CSS custom property declarations for WebUI | |
| 152 | 152 | findCSS string // CSS for find-in-page highlight styling | |
| 153 | - | autoCopyOnSelection bool // Whether to inject auto-copy selection script | |
| 154 | 153 | autoCopyConfigGetter func() bool // Dynamic getter for auto-copy config | |
| 155 | 154 | } | |
| 156 | 155 | ||
| @@ -150,7 +150,6 @@ type ContentInjector struct { | |||||
| 150 | colorResolver port.ColorSchemeResolver | 150 | colorResolver port.ColorSchemeResolver | ||
| 151 | themeCSSVars string // CSS custom property declarations for WebUI | 151 | themeCSSVars string // CSS custom property declarations for WebUI | ||
| 152 | findCSS string // CSS for find-in-page highlight styling | 152 | findCSS string // CSS for find-in-page highlight styling | ||
| 153 | - | autoCopyOnSelection bool // Whether to inject auto-copy selection script | |||
| 154 | autoCopyConfigGetter func() bool // Dynamic getter for auto-copy config | 153 | autoCopyConfigGetter func() bool // Dynamic getter for auto-copy config | ||
| 155 | } | 154 | } | ||
| 156 | 155 | ||||
M internal/ui/app.go +1 -1
| @@ -156,7 +156,7 @@ func New(deps *Dependencies) (*App, error) { | |||
| 156 | 156 | cb := glib.SourceFunc(func(_ uintptr) bool { | |
| 157 | 157 | if app.appToaster != nil { | |
| 158 | 158 | app.appToaster.Show(ctx, "Copied to clipboard", component.ToastInfo, | |
| 159 | - | component.WithDuration(800), // Brief notification | |
| 159 | + | component.WithDuration(component.ToastBriefDurationMs), | |
| 160 | 160 | component.WithPosition(component.ToastPositionBottomRight), | |
| 161 | 161 | ) | |
| 162 | 162 | } | |
| @@ -156,7 +156,7 @@ func New(deps *Dependencies) (*App, error) { | |||||
| 156 | cb := glib.SourceFunc(func(_ uintptr) bool { | 156 | cb := glib.SourceFunc(func(_ uintptr) bool { | ||
| 157 | if app.appToaster != nil { | 157 | if app.appToaster != nil { | ||
| 158 | app.appToaster.Show(ctx, "Copied to clipboard", component.ToastInfo, | 158 | app.appToaster.Show(ctx, "Copied to clipboard", component.ToastInfo, | ||
| 159 | - | component.WithDuration(800), // Brief notification | 159 | + | component.WithDuration(component.ToastBriefDurationMs), |
| 160 | component.WithPosition(component.ToastPositionBottomRight), | 160 | component.WithPosition(component.ToastPositionBottomRight), | ||
| 161 | ) | 161 | ) | ||
| 162 | } | 162 | } | ||
M internal/ui/component/toaster.go +2 -0
| @@ -16,6 +16,8 @@ import ( | |||
| 16 | 16 | const ( | |
| 17 | 17 | // Default auto-dismiss timeout in milliseconds. | |
| 18 | 18 | toastDismissTimeoutMs = 1500 | |
| 19 | + | // ToastBriefDurationMs is the duration for brief notifications (e.g., clipboard copy). | |
| 20 | + | ToastBriefDurationMs = 800 | |
| 19 | 21 | ) | |
| 20 | 22 | ||
| 21 | 23 | // ToastLevel indicates the visual style of a toast notification. | |
| @@ -16,6 +16,8 @@ import ( | |||||
| 16 | const ( | 16 | const ( | ||
| 17 | // Default auto-dismiss timeout in milliseconds. | 17 | // Default auto-dismiss timeout in milliseconds. | ||
| 18 | toastDismissTimeoutMs = 1500 | 18 | toastDismissTimeoutMs = 1500 | ||
| 19 | + | // ToastBriefDurationMs is the duration for brief notifications (e.g., clipboard copy). | |||
| 20 | + | ToastBriefDurationMs = 800 | |||
| 19 | ) | 21 | ) | ||
| 20 | 22 | ||||
| 21 | // ToastLevel indicates the visual style of a toast notification. | 23 | // ToastLevel indicates the visual style of a toast notification. | ||