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:
parent
8e81a04188
commit
f22f6e7658
@ -13,8 +13,6 @@ import (
|
||||
"github.com/walles/moar/twin"
|
||||
)
|
||||
|
||||
type _PagerMode int
|
||||
|
||||
type PagerMode interface {
|
||||
onKey(key twin.KeyCode)
|
||||
onRune(char rune)
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user