Author: adrian
Date: Sat Feb 13 15:27:09 2010
New Revision: 8500

URL: http://svn.slimdevices.com/jive?rev=8500&view=rev
Log:
Bug: 15561
Description: split very long words onto multiple lines in labels as otherwise 
they break the max width of an SDL surface

Modified:
    7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_label.c

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_label.c
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_label.c?rev=8500&r1=8499&r2=8500&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_label.c (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_label.c Sat Feb 13 
15:27:09 2010
@@ -17,6 +17,8 @@
 #define SCROLL_PAD_LEFT   -200
 #define SCROLL_PAD_START  -100
 
+#define MAX_CHARS 1000  // max number or characters before spliting text in a 
label
+                        // this gets round SDLs limitation on max surface width
 
 typedef struct label_line {
        JiveSurface *text_sh;
@@ -179,12 +181,15 @@
                Uint32 fg, sh;
                bool is_sh;
                size_t len;
-
-               /* find line ending */
+               unsigned count;
+
+               /* find line ending and split very long words*/
+               count = 0;
                c = utf8_get_char(ptr, &nptr);
-               while (c != '\0' && c != '\n' && c != '\r') {
+               while (c != '\0' && c != '\n' && c != '\r' && count < 
MAX_CHARS) {
                        ptr = nptr;
                        c = utf8_get_char(ptr, &nptr);
+                       count++;
                }
                len = nptr - str - 1;
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to