From d5f6eee69f6f66e4b0ed331b93b31097ff917c5b Mon Sep 17 00:00:00 2001 From: DevLeonardoK Date: Tue, 14 Jul 2026 21:45:37 -0300 Subject: [PATCH] Support cycling the log tail count from the services panel too The services panel's Logs tab renders the underlying container's logs through the same code path, so bind 't' there as well and include the tail value in the services context cache key so the tab re-renders when the value changes. Also switch the tail-limiting writer to SetContent so the clear+rewrite is atomic and the view never renders empty in between. --- docs/keybindings/Keybindings_de.md | 1 + docs/keybindings/Keybindings_en.md | 1 + docs/keybindings/Keybindings_es.md | 1 + docs/keybindings/Keybindings_fr.md | 1 + docs/keybindings/Keybindings_nl.md | 1 + docs/keybindings/Keybindings_pl.md | 1 + docs/keybindings/Keybindings_pt.md | 1 + docs/keybindings/Keybindings_tr.md | 1 + docs/keybindings/Keybindings_zh.md | 1 + pkg/gui/container_logs.go | 9 +++++++-- pkg/gui/keybindings.go | 7 +++++++ pkg/gui/services_panel.go | 2 +- 12 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/keybindings/Keybindings_de.md b/docs/keybindings/Keybindings_de.md index b3a2642c..3934cf56 100644 --- a/docs/keybindings/Keybindings_de.md +++ b/docs/keybindings/Keybindings_de.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: start a: anbinden m: zeige Protokolle + t: cycle how many log lines are shown U: up project D: down project R: zeige Neustartoptionen diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 390f6bcc..b9d7160f 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: start a: attach m: view logs + t: cycle how many log lines are shown U: up project D: down project R: view restart options diff --git a/docs/keybindings/Keybindings_es.md b/docs/keybindings/Keybindings_es.md index 41725673..a0a46c51 100644 --- a/docs/keybindings/Keybindings_es.md +++ b/docs/keybindings/Keybindings_es.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: iniciar a: attach m: ver logs + t: cycle how many log lines are shown U: levantar proyecto D: dar de baja el proyecto R: ver opciones de reinicio diff --git a/docs/keybindings/Keybindings_fr.md b/docs/keybindings/Keybindings_fr.md index bb8db287..323be0d1 100644 --- a/docs/keybindings/Keybindings_fr.md +++ b/docs/keybindings/Keybindings_fr.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: démarrer a: attacher m: voir les enregistrements + t: cycle how many log lines are shown U: up project D: down project R: voir les options de redémarrage diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index 2c9a0755..1d4902e0 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: start a: verbinden m: bekijk logs + t: cycle how many log lines are shown U: up project D: down project R: bekijk herstart opties diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index bd35a817..c08a1113 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: start a: przyczep m: pokaż logi + t: cycle how many log lines are shown U: up project D: down project R: pokaż opcje restartu diff --git a/docs/keybindings/Keybindings_pt.md b/docs/keybindings/Keybindings_pt.md index d021f414..99183344 100644 --- a/docs/keybindings/Keybindings_pt.md +++ b/docs/keybindings/Keybindings_pt.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: iniciar a: anexar m: ver logs + t: cycle how many log lines are shown U: subir projeto D: derrubar projeto R: ver opções de reinício diff --git a/docs/keybindings/Keybindings_tr.md b/docs/keybindings/Keybindings_tr.md index f17c0f47..d97ea769 100644 --- a/docs/keybindings/Keybindings_tr.md +++ b/docs/keybindings/Keybindings_tr.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: start a: bağlan/iliştir m: kayıt defterini görüntüle + t: cycle how many log lines are shown U: up project D: down project R: yeniden başlatma seçeneklerini görüntüle diff --git a/docs/keybindings/Keybindings_zh.md b/docs/keybindings/Keybindings_zh.md index 678ee209..3263d839 100644 --- a/docs/keybindings/Keybindings_zh.md +++ b/docs/keybindings/Keybindings_zh.md @@ -46,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct S: 启动项目 a: attach m: 查看日志 + t: cycle how many log lines are shown U: 创建并启动容器 D: 停止并移除容器 R: 查看重启选项 diff --git a/pkg/gui/container_logs.go b/pkg/gui/container_logs.go index 1fda78fd..7d00517d 100644 --- a/pkg/gui/container_logs.go +++ b/pkg/gui/container_logs.go @@ -44,6 +44,10 @@ func (gui *Gui) cycleContainerLogsTail(g *gocui.Gui, v *gocui.View) error { gui.State.ContainerLogsTail = containerLogsTailPresets[(currentIdx+1)%len(containerLogsTailPresets)] + if v != nil && v.Name() == "services" { + return gui.Panels.Services.HandleSelect() + } + return gui.Panels.Containers.HandleSelect() } @@ -77,8 +81,9 @@ func (w *tailLimitingWriter) Write(p []byte) (int, error) { w.lines = w.lines[excess:] } - w.view.Clear() - fmt.Fprint(w.view, strings.Join(w.lines, "\n")+"\n") + // SetContent clears and rewrites atomically, so the view never renders empty + // in between + w.view.SetContent(strings.Join(w.lines, "\n") + "\n") return len(p), nil } diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 2c7e0b0e..32f30929 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -325,6 +325,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleServiceRenderLogsToMain, Description: gui.Tr.ViewLogs, }, + { + ViewName: "services", + Key: 't', + Modifier: gocui.ModNone, + Handler: gui.cycleContainerLogsTail, + Description: gui.Tr.CycleContainerLogsTail, + }, { ViewName: "services", Key: 'U', diff --git a/pkg/gui/services_panel.go b/pkg/gui/services_panel.go index edc894e9..4b7fac8b 100644 --- a/pkg/gui/services_panel.go +++ b/pkg/gui/services_panel.go @@ -53,7 +53,7 @@ func (gui *Gui) getServicesPanel() *panels.SideListPanel[*commands.Service] { if service.Container == nil { return "services-" + service.ID } - return "services-" + service.ID + "-" + service.Container.ID + "-" + service.Container.Container.State + return "services-" + service.ID + "-" + service.Container.ID + "-" + service.Container.Container.State + "-" + gui.State.ContainerLogsTail }, }, ListPanel: panels.ListPanel[*commands.Service]{