Browse Source

Display max 24 chars of profile remark.

Qiu Yuzhou 5 years ago
parent
commit
e3795096ea

+ 1 - 1
ShadowsocksX-NG/AppDelegate.swift

@@ -491,7 +491,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
             if mgr.activeProfileId == p.uuid {
             if mgr.activeProfileId == p.uuid {
                 var profileName :String
                 var profileName :String
                 if !p.remark.isEmpty {
                 if !p.remark.isEmpty {
-                    profileName = p.remark
+                    profileName = String(p.remark.prefix(24))
                 } else {
                 } else {
                     profileName = p.serverHost
                     profileName = p.serverHost
                 }
                 }

+ 1 - 1
ShadowsocksX-NG/PreferencesWindowController.swift

@@ -250,7 +250,7 @@ class PreferencesWindowController: NSWindowController
         let profile = profileMgr.profiles[index]
         let profile = profileMgr.profiles[index]
         let isActive = (profileMgr.activeProfileId == profile.uuid)
         let isActive = (profileMgr.activeProfileId == profile.uuid)
         if !profile.remark.isEmpty {
         if !profile.remark.isEmpty {
-            return (profile.remark, isActive)
+            return (String(profile.remark.prefix(24)), isActive)
         } else {
         } else {
             return (profile.serverHost, isActive)
             return (profile.serverHost, isActive)
         }
         }

+ 1 - 1
ShadowsocksX-NG/ServerProfile.swift

@@ -328,7 +328,7 @@ class ServerProfile: NSObject, NSCopying {
         if remark.isEmpty {
         if remark.isEmpty {
             return "\(serverHost):\(serverPort)"
             return "\(serverHost):\(serverPort)"
         } else {
         } else {
-            return "\(remark) (\(serverHost):\(serverPort))"
+            return "\(String(remark.prefix(24))) (\(serverHost):\(serverPort))"
         }
         }
     }
     }