add function to update board mode
All checks were successful
/ test (pull_request) Successful in 32s
/ lint (pull_request) Successful in 47s

This commit is contained in:
Dan Anglin 2024-01-17 08:56:14 +00:00
parent 70238291e7
commit 04f76daae9
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
2 changed files with 9 additions and 5 deletions

View file

@ -49,8 +49,7 @@ func (a *App) move() {
if a.mode == normal {
a.statusSelection.cardID = a.focusedCardID()
a.statusSelection.currentStatusID = a.focusedStatusID()
a.mode = selection
a.modeView.update(a.mode)
a.updateBoardMode(selection)
}
}
@ -120,14 +119,13 @@ func (a *App) selected() {
}
a.statusSelection = statusSelection{0, 0, 0}
a.mode = normal
a.updateBoardMode(normal)
a.refresh(false)
}
}
func (a *App) escape() {
if a.mode != normal {
a.mode = normal
a.modeView.update(a.mode)
a.updateBoardMode(normal)
}
}

View file

@ -270,6 +270,12 @@ func (a *App) boardMode() boardMode {
return a.mode
}
// updateBoardMode updates the board mode.
func (a *App) updateBoardMode(mode boardMode) {
a.mode = mode
a.modeView.update(mode)
}
// focusedCardID returns the ID of the card in focus.
func (a *App) focusedCardID() int {
focusedCard := a.columns[a.focusedColumn].focusedCard