diff --git a/internal/board/board.go b/internal/board/board.go index a9d97c6..1a95f47 100644 --- a/internal/board/board.go +++ b/internal/board/board.go @@ -45,7 +45,6 @@ func Open(path string) (Board, error) { } } - return board, nil } @@ -106,7 +105,7 @@ func (b *Board) DeleteStatus() error { } type CardArgs struct { - NewTitle string + NewTitle string NewContent string } @@ -218,7 +217,7 @@ func (b *Board) UpdateCard(args UpdateCardArgs) error { } type UpdateCardStatusArgs struct { - CardID int + CardID int OldStatusID int NewStatusID int } diff --git a/internal/board/board_test.go b/internal/board/board_test.go index b0c705c..78ee88e 100644 --- a/internal/board/board_test.go +++ b/internal/board/board_test.go @@ -51,7 +51,7 @@ func testCreateCard(t *testing.T, b board.Board, title, content string, wantID i t.Helper() args := board.CardArgs{ - NewTitle: title, + NewTitle: title, NewContent: content, } @@ -108,7 +108,7 @@ func testUpdateCard(t *testing.T, b board.Board, cardID int, newTitle, newConten args := board.UpdateCardArgs{ CardID: cardID, CardArgs: board.CardArgs{ - NewTitle: newTitle, + NewTitle: newTitle, NewContent: newContent, }, } @@ -141,7 +141,7 @@ func testUpdateCardContent(t *testing.T, b board.Board, cardID int, expectedTitl args := board.UpdateCardArgs{ CardID: cardID, CardArgs: board.CardArgs{ - NewTitle: "", + NewTitle: "", NewContent: newContent, }, } diff --git a/internal/ui/column.go b/internal/ui/column.go index fd0c523..a0985a7 100644 --- a/internal/ui/column.go +++ b/internal/ui/column.go @@ -22,9 +22,16 @@ func (u *UI) newColumn(statusID int, statusName string) column { cards.SetWrapAround(false) cards.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { - if event.Rune() == 'h' || event.Key() == tcell.KeyLeft { + switch event.Rune() { + case 'q': + u.pages.ShowPage(quitPageName) + u.SetFocus(u.quit) + case 'a': + u.pages.ShowPage(addPageName) + u.SetFocus(u.add) + case 'h': u.shiftColumnFocus(shiftLeft) - } else if event.Rune() == 'l' || event.Key() == tcell.KeyRight { + case 'l': u.shiftColumnFocus(shiftRight) } diff --git a/internal/ui/ui.go b/internal/ui/ui.go index 6a52ecd..327aa4a 100644 --- a/internal/ui/ui.go +++ b/internal/ui/ui.go @@ -65,14 +65,11 @@ func (u *UI) init() { u.pages.AddPage(addPageName, u.add, false, false) u.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { - if event.Rune() == 'q' { - u.pages.ShowPage(quitPageName) - u.SetFocus(u.quit) - } else if event.Rune() == 'o' { - u.openBoard("") - } else if event.Rune() == 'a' { - u.pages.ShowPage(addPageName) - u.SetFocus(u.add) + switch event.Rune() { + case 'o': + if u.flex.HasFocus() && len(u.columns) == 0 { + u.openBoard("") + } } return event