diff --git a/Makefile b/Makefile
index e6b34759..abde653b 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ PACKAGE := github.com/derailed/$(NAME)
GIT_REV ?= $(shell git rev-parse --short HEAD)
SOURCE_DATE_EPOCH ?= $(shell date +%s)
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
-VERSION ?= v0.25.17
+VERSION ?= v0.25.18
IMG_NAME := derailed/k9s
IMAGE := ${IMG_NAME}:${VERSION}
diff --git a/change_logs/release_v0.25.18.md b/change_logs/release_v0.25.18.md
new file mode 100644
index 00000000..668697b0
--- /dev/null
+++ b/change_logs/release_v0.25.18.md
@@ -0,0 +1,25 @@
+
+
+# Release v0.25.18
+
+## Notes
+
+Thank you to all that contributed with flushing out issues and enhancements for K9s! I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev and see if we're happier with some of the fixes! If you've filed an issue please help me verify and close. Your support, kindness and awesome suggestions to make K9s better are as ever very much noted and appreciated!
+
+If you feel K9s is helping your Kubernetes journey, please consider joining our [sponsorship program](https://github.com/sponsors/derailed) and/or make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
+
+On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)
+
+---
+
+## Maintenance Release
+
+---
+
+## Resolved Issues
+
+* [Issue #1402](https://github.com/derailed/k9s/issues/1402) Sort functionality does not work properly on v0.25.16. With Feelings!
+
+---
+
+
© 2021 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)
diff --git a/internal/ui/select_table.go b/internal/ui/select_table.go
index e59ac052..9bbd8497 100644
--- a/internal/ui/select_table.go
+++ b/internal/ui/select_table.go
@@ -103,7 +103,7 @@ func (s *SelectTable) SelectRow(r int, broadcast bool) {
if !broadcast {
s.SetSelectionChangedFunc(nil)
}
- if r >= s.model.Count() {
+ if s.model.Count() > 0 && r >= s.model.Count() {
r = s.model.Count()
}
defer s.SetSelectionChangedFunc(s.selectionChanged)
diff --git a/internal/ui/table.go b/internal/ui/table.go
index bead0aed..e967a217 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -191,18 +191,14 @@ func (t *Table) Update(data render.TableData, hasMetrics bool) {
func (t *Table) doUpdate(data render.TableData) {
if client.IsAllNamespaces(data.Namespace) {
t.actions[KeyShiftP] = NewKeyAction("Sort Namespace", t.SortColCmd("NAMESPACE", true), false)
- t.sortCol.name = "NAMESPACE"
} else {
t.actions.Delete(KeyShiftP)
}
- var cols []string
- if t.viewSetting != nil {
+ cols := t.header.Columns(t.wide)
+ if t.viewSetting != nil && len(t.viewSetting.Columns) > 0 {
cols = t.viewSetting.Columns
}
- if len(cols) == 0 {
- cols = t.header.Columns(t.wide)
- }
custData := data.Customize(cols, t.wide)
if t.viewSetting != nil && t.viewSetting.SortColumn != "" {
tokens := strings.Split(t.viewSetting.SortColumn, ":")
@@ -214,6 +210,9 @@ func (t *Table) doUpdate(data render.TableData) {
}
}
+ if t.sortCol.name == "" && client.IsAllNamespaces(data.Namespace) {
+ t.sortCol.name = "NAMESPACE"
+ }
if t.sortCol.name == "" || (t.sortCol.name == "NAMESPACE" && !client.IsAllNamespaces(data.Namespace)) && len(custData.Header) > 0 {
if idx := custData.Header.IndexOf("NAME", false); idx >= 0 {
t.sortCol.name = custData.Header[idx].Name