From 00a79ceb0209e185fd6f6a34f21a96e41cc0a111 Mon Sep 17 00:00:00 2001 From: go-to-k <24818752+go-to-k@users.noreply.github.com> Date: Mon, 19 Aug 2024 22:42:42 +0900 Subject: [PATCH] fix lint error --- internal/io/ui.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/io/ui.go b/internal/io/ui.go index 13fa459..cadad96 100644 --- a/internal/io/ui.go +++ b/internal/io/ui.go @@ -261,11 +261,12 @@ func (u *UI) View() string { } if len(contents) > SelectionPageSize { - if u.Cursor < SelectionPageSize/2 { + switch { + case u.Cursor < SelectionPageSize/2: contents = contents[:SelectionPageSize] - } else if u.Cursor > len(u.Choices)-SelectionPageSize/2 { + case u.Cursor > len(u.Choices)-SelectionPageSize/2: contents = contents[len(u.Choices)-SelectionPageSize:] - } else { + default: contents = contents[u.Cursor-SelectionPageSize/2 : u.Cursor+SelectionPageSize/2] }