From bff020c4709f64aabdc503f1a998882046e63547 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur Date: Mon, 15 Jul 2024 12:32:34 +0200 Subject: [PATCH] fix: closing task details pane moves to next page --- README.md | 2 +- internal/ui/help.go | 2 +- internal/ui/initial.go | 7 ++++++- internal/ui/update.go | 6 ++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37bf27d..d9aa976 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ G go to the end tab move between views c update context for a task C toggle showing context -d show task details in a full screen pane +d toggle Task Details pane v toggle between compact and spacious view h/l move backwards/forwards when in the task details view q/esc/ctrl+c go back/quit diff --git a/internal/ui/help.go b/internal/ui/help.go index 4a0e45e..954dedc 100644 --- a/internal/ui/help.go +++ b/internal/ui/help.go @@ -23,7 +23,7 @@ G go to the end tab move between views c update context for a task C toggle showing context -d show task details in a full screen pane +d toggle Task Details pane v toggle between compact and spacious view h/l move backwards/forwards when in the task details view q/esc/ctrl+c go back/quit diff --git a/internal/ui/initial.go b/internal/ui/initial.go index efd6560..725626f 100644 --- a/internal/ui/initial.go +++ b/internal/ui/initial.go @@ -30,11 +30,13 @@ func InitialModel(db *sql.DB, config Config) model { taskList.SetFilteringEnabled(false) taskList.SetShowHelp(false) taskList.DisableQuitKeybindings() + taskList.KeyMap.PrevPage.SetKeys("left", "h", "pgup") + taskList.KeyMap.NextPage.SetKeys("right", "l", "pgdown") + taskList.Styles.Title = taskList.Styles.Title. Foreground(lipgloss.Color(defaultBackgroundColor)). Background(lipgloss.Color(config.TaskListColor)). Bold(true) - taskListTitleStyle := titleStyle.Background(lipgloss.Color(config.TaskListColor)) atlSelItemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color(config.ArchivedTaskListColor)) @@ -53,6 +55,9 @@ func InitialModel(db *sql.DB, config Config) model { archivedTaskList.SetFilteringEnabled(false) archivedTaskList.SetShowHelp(false) archivedTaskList.DisableQuitKeybindings() + archivedTaskList.KeyMap.PrevPage.SetKeys("left", "h", "pgup") + archivedTaskList.KeyMap.NextPage.SetKeys("right", "l", "pgdown") + archivedTaskList.Styles.Title = archivedTaskList.Styles.Title. Foreground(lipgloss.Color(defaultBackgroundColor)). Background(lipgloss.Color(config.ArchivedTaskListColor)). diff --git a/internal/ui/update.go b/internal/ui/update.go index f161f4d..3a47508 100644 --- a/internal/ui/update.go +++ b/internal/ui/update.go @@ -528,6 +528,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { taskList.SetShowHelp(false) taskList.DisableQuitKeybindings() taskList.Styles.Title = m.taskList.Styles.Title + taskList.KeyMap.PrevPage.SetKeys("left", "h", "pgup") + taskList.KeyMap.NextPage.SetKeys("right", "l", "pgdown") + m.taskList = taskList m.taskList.Select(tlIndex) @@ -535,6 +538,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { archivedTaskList.SetFilteringEnabled(false) archivedTaskList.SetShowHelp(false) archivedTaskList.DisableQuitKeybindings() + archivedTaskList.KeyMap.PrevPage.SetKeys("left", "h", "pgup") + archivedTaskList.KeyMap.NextPage.SetKeys("right", "l", "pgdown") + m.archivedTaskList = archivedTaskList m.archivedTaskList.Select(atlIndex)