From e3795096ea9dd82d15f734a150d8bd472fe0b112 Mon Sep 17 00:00:00 2001 From: Qiu Yuzhou Date: Sat, 12 Oct 2019 16:51:01 +0800 Subject: [PATCH] Display max 24 chars of profile remark. --- ShadowsocksX-NG/AppDelegate.swift | 2 +- ShadowsocksX-NG/PreferencesWindowController.swift | 2 +- ShadowsocksX-NG/ServerProfile.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index 5ba287e..dd13c41 100755 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -491,7 +491,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele if mgr.activeProfileId == p.uuid { var profileName :String if !p.remark.isEmpty { - profileName = p.remark + profileName = String(p.remark.prefix(24)) } else { profileName = p.serverHost } diff --git a/ShadowsocksX-NG/PreferencesWindowController.swift b/ShadowsocksX-NG/PreferencesWindowController.swift index 0da23f1..e1e1332 100644 --- a/ShadowsocksX-NG/PreferencesWindowController.swift +++ b/ShadowsocksX-NG/PreferencesWindowController.swift @@ -250,7 +250,7 @@ class PreferencesWindowController: NSWindowController let profile = profileMgr.profiles[index] let isActive = (profileMgr.activeProfileId == profile.uuid) if !profile.remark.isEmpty { - return (profile.remark, isActive) + return (String(profile.remark.prefix(24)), isActive) } else { return (profile.serverHost, isActive) } diff --git a/ShadowsocksX-NG/ServerProfile.swift b/ShadowsocksX-NG/ServerProfile.swift index 1016e23..c5b95aa 100644 --- a/ShadowsocksX-NG/ServerProfile.swift +++ b/ShadowsocksX-NG/ServerProfile.swift @@ -328,7 +328,7 @@ class ServerProfile: NSObject, NSCopying { if remark.isEmpty { return "\(serverHost):\(serverPort)" } else { - return "\(remark) (\(serverHost):\(serverPort))" + return "\(String(remark.prefix(24))) (\(serverHost):\(serverPort))" } }