diff --git a/README.md b/README.md index 7505bea0..30538442 100644 --- a/README.md +++ b/README.md @@ -431,6 +431,8 @@ You can now override the context portForward default address configuration by se sinceSeconds: 300 # => tail the last 5 mins. # Toggles log line wrap. Default false textWrap: false + # Autoscroll in logs will be disabled. Default is false. + disableAutoscroll: false # Toggles log line timestamp info. Default false showTime: false # Provide shell pod customization when nodeShell feature gate is enabled! @@ -987,6 +989,7 @@ k9s: buffer: 5000 sinceSeconds: -1 textWrap: false + disableAutoscroll: false showTime: false thresholds: cpu: diff --git a/internal/config/json/schemas/k9s.json b/internal/config/json/schemas/k9s.json index e217bbec..e6fc4d83 100644 --- a/internal/config/json/schemas/k9s.json +++ b/internal/config/json/schemas/k9s.json @@ -103,6 +103,7 @@ "buffer": {"type": "integer"}, "sinceSeconds": {"type": "integer"}, "textWrap": {"type": "boolean"}, + "disableAutoscroll": {"type": "boolean"}, "showTime": {"type": "boolean"} } }, diff --git a/internal/config/json/testdata/k9s/cool.yaml b/internal/config/json/testdata/k9s/cool.yaml index 5261b9d7..b933faf4 100644 --- a/internal/config/json/testdata/k9s/cool.yaml +++ b/internal/config/json/testdata/k9s/cool.yaml @@ -29,6 +29,7 @@ k9s: buffer: 5000 sinceSeconds: -1 textWrap: false + disableAutoscroll: false showTime: false thresholds: cpu: diff --git a/internal/config/json/testdata/k9s/toast.yaml b/internal/config/json/testdata/k9s/toast.yaml index 61dcda41..c180e99f 100644 --- a/internal/config/json/testdata/k9s/toast.yaml +++ b/internal/config/json/testdata/k9s/toast.yaml @@ -23,6 +23,7 @@ k9s: buffer: 5000 sinceSeconds: -1 textWrap: false + disableAutoscroll: false showTime: false thresholds: cpu: diff --git a/internal/config/logger.go b/internal/config/logger.go index 4c6a6a18..7446c418 100644 --- a/internal/config/logger.go +++ b/internal/config/logger.go @@ -16,11 +16,12 @@ const ( // Logger tracks logger options. type Logger struct { - TailCount int64 `json:"tail" yaml:"tail"` - BufferSize int `json:"buffer" yaml:"buffer"` - SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"` - TextWrap bool `json:"textWrap" yaml:"textWrap"` - ShowTime bool `json:"showTime" yaml:"showTime"` + TailCount int64 `json:"tail" yaml:"tail"` + BufferSize int `json:"buffer" yaml:"buffer"` + SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"` + TextWrap bool `json:"textWrap" yaml:"textWrap"` + DisableAutoscroll bool `json:"disableAutoscroll" yaml:"disableAutoscroll"` + ShowTime bool `json:"showTime" yaml:"showTime"` } // NewLogger returns a new instance. diff --git a/internal/config/testdata/configs/default.yaml b/internal/config/testdata/configs/default.yaml index abf8432b..937972f0 100644 --- a/internal/config/testdata/configs/default.yaml +++ b/internal/config/testdata/configs/default.yaml @@ -31,6 +31,7 @@ k9s: buffer: 5000 sinceSeconds: -1 textWrap: false + disableAutoscroll: false showTime: false thresholds: cpu: diff --git a/internal/config/testdata/configs/expected.yaml b/internal/config/testdata/configs/expected.yaml index e85a32f1..e7c20911 100644 --- a/internal/config/testdata/configs/expected.yaml +++ b/internal/config/testdata/configs/expected.yaml @@ -31,6 +31,7 @@ k9s: buffer: 800 sinceSeconds: -1 textWrap: false + disableAutoscroll: false showTime: false thresholds: cpu: diff --git a/internal/config/testdata/configs/k9s.yaml b/internal/config/testdata/configs/k9s.yaml index 8f3546d3..c33ed9f6 100644 --- a/internal/config/testdata/configs/k9s.yaml +++ b/internal/config/testdata/configs/k9s.yaml @@ -31,6 +31,7 @@ k9s: buffer: 2000 sinceSeconds: -1 textWrap: false + disableAutoscroll: false showTime: false thresholds: cpu: diff --git a/internal/config/testdata/configs/k9s_toast.yaml b/internal/config/testdata/configs/k9s_toast.yaml index 668326ef..9980bd75 100644 --- a/internal/config/testdata/configs/k9s_toast.yaml +++ b/internal/config/testdata/configs/k9s_toast.yaml @@ -29,6 +29,7 @@ k9s: buffer: 2000 sinceSeconds: -1 textWrap: false + disableAutoscroll: false showTime: false thresholds: cpu: diff --git a/internal/view/log_indicator.go b/internal/view/log_indicator.go index ce80654b..1b29a0b5 100644 --- a/internal/view/log_indicator.go +++ b/internal/view/log_indicator.go @@ -39,6 +39,10 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles, allContainers bo showTime: cfg.K9s.Logger.ShowTime, shouldDisplayAllContainers: allContainers, } + + if cfg.K9s.Logger.DisableAutoscroll { + l.scrollStatus = 0 + } l.StylesChanged(styles) styles.AddListener(&l) l.SetTextAlign(tview.AlignCenter)