From 61da208c9571f3348eb0e11400fa54365d49a366 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 5 May 2019 17:38:04 +0200 Subject: ui: use natural sorting order --- ui/tray.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ui/tray.go') diff --git a/ui/tray.go b/ui/tray.go index c5902359..27b03f72 100644 --- a/ui/tray.go +++ b/ui/tray.go @@ -7,6 +7,7 @@ package ui import ( "fmt" + "golang.zx2c4.com/wireguard/windows/conf" "sort" "strings" @@ -168,7 +169,9 @@ func (tray *Tray) addTunnelAction(tunnel *service.Tunnel) { for name := range tray.tunnels { names = append(names, name) } - sort.Strings(names) //TODO: use correct sorting order for this + sort.SliceStable(names, func(i, j int) bool { + return conf.TunnelNameIsLess(names[i], names[j]) + }) var ( idx int -- cgit v1.2.3-59-g8ed1b