mirror of
				https://github.com/Ryujinx/Ryujinx.git
				synced 2025-11-04 12:14:53 +00:00 
			
		
		
		
	Track if the string has actually been modified correctly.
This commit is contained in:
		
							parent
							
								
									36e7f56f2b
								
							
						
					
					
						commit
						c381567328
					
				| 
						 | 
				
			
			@ -95,18 +95,21 @@ namespace Ryujinx.UI.Common
 | 
			
		|||
 | 
			
		||||
        private static string TruncateToByteLength(string input, int byteLimit)
 | 
			
		||||
        {
 | 
			
		||||
            bool isModified = false;
 | 
			
		||||
            string trimmed = input;
 | 
			
		||||
 | 
			
		||||
            while (Encoding.UTF8.GetByteCount(trimmed) > byteLimit)
 | 
			
		||||
            {
 | 
			
		||||
                // Remove one character from the end of the string at a time.
 | 
			
		||||
                trimmed = trimmed[..^1];
 | 
			
		||||
 | 
			
		||||
                isModified = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Remove another 3 characters to make sure we have room for "…".
 | 
			
		||||
            trimmed = trimmed[..^3].TrimEnd() + "…";
 | 
			
		||||
 | 
			
		||||
            return trimmed == input ? input : trimmed;
 | 
			
		||||
            return isModified ? trimmed : input;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void Exit()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue