Explorar o código

Ellipsis in messages will not be broken apart, as with the description for Speculum.

OnionKnight %!s(int64=16) %!d(string=hai) anos
pai
achega
4845ba80bd
Modificáronse 1 ficheiros con 14 adicións e 8 borrados
  1. 14 8
      client/CMessage.cpp

+ 14 - 8
client/CMessage.cpp

@@ -152,15 +152,21 @@ std::vector<std::string> * CMessage::breakText(std::string text, size_t maxLineS
 			 * suitable character. */
 			int pos = z-1;
 
+			// Do not break an ellipsis, backtrack until whitespace.
+			if (text[z] == '.') {
+				while (pos != 0 && text[pos] != ' ')
+					pos--;
+			} else {
 			/* TODO: boost should have a nice method to do that. */
-			while(pos > 0 &&
-				  text[pos] != ' ' && 
-				  text[pos] != ',' &&
-				  text[pos] != '.' &&
-				  text[pos] != ';' &&
-				  text[pos] != '!' &&
-				  text[pos] != '?')
-				pos --;
+				while(pos > 0 &&
+					  text[pos] != ' ' && 
+					  text[pos] != ',' &&
+					  text[pos] != '.' &&
+					  text[pos] != ';' &&
+					  text[pos] != '!' &&
+					  text[pos] != '?')
+					pos --;
+			}
 			if (pos > 0)
 				z = pos+1;
 		}