1
1
mirror of https://github.com/walles/moar.git synced 2024-11-22 21:50:43 +03:00

Silence false positive linter warnings

This commit is contained in:
Johan Walles 2024-01-09 14:10:44 +01:00
parent 8e81a04188
commit f22f6e7658
3 changed files with 4 additions and 2 deletions

View File

@ -13,8 +13,6 @@ import (
"github.com/walles/moar/twin"
)
type _PagerMode int
type PagerMode interface {
onKey(key twin.KeyCode)
onRune(char rune)

View File

@ -11,11 +11,13 @@ func (m PagerModeNotFound) drawFooter(_ string, _ string) {
}
func (m PagerModeNotFound) onKey(key twin.KeyCode) {
//nolint:gosimple // The linter's advice is just wrong here
m.pager.mode = PagerModeViewing{pager: m.pager}
m.pager.mode.onKey(key)
}
func (m PagerModeNotFound) onRune(r rune) {
//nolint:gosimple // The linter's advice is just wrong here
m.pager.mode = PagerModeViewing{pager: m.pager}
m.pager.mode.onRune(r)
}

View File

@ -95,6 +95,7 @@ func removeLastChar(s string) string {
func (m PagerModeSearch) onKey(key twin.KeyCode) {
switch key {
case twin.KeyEscape, twin.KeyEnter:
//nolint:gosimple // The linter's advice is just wrong here
m.pager.mode = PagerModeViewing{pager: m.pager}
case twin.KeyBackspace, twin.KeyDelete:
@ -106,6 +107,7 @@ func (m PagerModeSearch) onKey(key twin.KeyCode) {
m.updateSearchPattern()
case twin.KeyUp, twin.KeyDown, twin.KeyPgUp, twin.KeyPgDown:
//nolint:gosimple // The linter's advice is just wrong here
m.pager.mode = PagerModeViewing{pager: m.pager}
m.pager.mode.onKey(key)