Skip to content

Commit 9d44ca0

Browse files
fix: scolling in logs view
1 parent c661217 commit 9d44ca0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

bugs.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
- interactive view has race conditions
2-
- interactive view cant scroll
1+
- interactive view has race conditions

pkg/ui/interactive_view.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,13 @@ func (m *interactiveView) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
253253
case "tab":
254254
if len(m.tabs) > 0 {
255255
m.activeIndex = (m.activeIndex + 1) % len(m.tabs)
256+
m.logsView.GotoBottom()
256257
cmds = append(cmds, m.listenToWriterUpdates, m.updateCurrentLogsView)
257258
}
258259
case "shift+tab":
259260
if len(m.tabs) > 0 {
260261
m.activeIndex = (m.activeIndex - 1 + len(m.tabs)) % len(m.tabs)
262+
m.logsView.GotoBottom()
261263
cmds = append(cmds, m.listenToWriterUpdates, m.updateCurrentLogsView)
262264
}
263265
}
@@ -288,7 +290,6 @@ func (m *interactiveView) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
288290
// this is to ignore old (pending) updates from other tabs after the tab changed
289291
if msg.tabId == m.activeIndex {
290292
m.logsView.SetContent(string(msg.content))
291-
m.logsView.GotoBottom()
292293
if m.activeIndex >= 0 {
293294
cmds = append(cmds, m.listenToWriterUpdates)
294295
}
@@ -299,6 +300,7 @@ func (m *interactiveView) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
299300
clickedIdx := m.determineTabClicked(msg.X)
300301
if clickedIdx >= 0 {
301302
m.activeIndex = clickedIdx
303+
m.logsView.GotoBottom()
302304
cmds = append(cmds, m.listenToWriterUpdates, m.updateCurrentLogsView)
303305
}
304306
}

0 commit comments

Comments
 (0)