ee6ff3f35374f858b28b3f38d127f1800345a364
max
  Tue May 24 09:41:04 2016 -0700
fixing missing line wrap in bigBedClick refs #17370

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 7d3c019..17dc990 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -1591,31 +1591,33 @@
     count++;
 
     // do not print a row if the fieldName from the .as file is in the "skipFields" list
     if (skipIds && slNameInList(skipIds, fieldName))
         continue;
 
     // skip this row if it's empty and "skipEmptyFields" option is set
     if (skipEmptyFields && isEmpty(fields[ix]))
         continue;
 
     // split this table to separate current row from the previous one, if the trackDb option is set
     if (sepFields && slNameInList(sepFields, fieldName))
         printf("</tr></table>\n<p>\n<table class='bedExtraTbl'>");
 
     // field description
-    printf("<tr><td>%s</td>", col->comment); // bold style now in HGStyle.css
+    puts("<tr><td>");
+    printAddWbr(col->comment, 10);
+    puts("</td>"); // bold style now in HGStyle.css
 
     if (col->isList || col->isArray || col->lowType->stringy || asTypesIsInt(col->lowType->type))
         printIdOrLinks(col, fieldToUrl, tdb, fields[ix]);
     else if (asTypesIsFloating(col->lowType->type))
         {
         double valDouble = strtod(fields[ix],NULL);
         if (errno == 0 && valDouble != 0)
             printf("<td>%g</td></tr>\n", valDouble);
         else
             printf("<td>%s</td></tr>\n", fields[ix]); // decided not to print error
         }
     else
         printf("<td>%s</td></tr>\n", fields[ix]);
     }
 asObjectFree(&as);
@@ -24755,30 +24757,55 @@
     va_end(args);
     }
 return res;
 }
 
 bool sameWords(char *a, ...)
 /* returns true if a is equal to any b */
 {
 va_list args;
 va_start(args, a);
 bool res = vsameWords(a, args);
 va_end(args);
 return res;
 }
 
+void printAddWbr(char *text, int distance) 
+/* a crazy hack for firefox/mozilla that is unable to break long words in tables
+ * We need to add a <wbr> tag every x characters in the text to make text breakable.
+ */
+{
+int i;
+i = 0;
+char *c;
+c = text;
+bool doNotBreak = FALSE;
+while (*c != 0) 
+    {
+    if ((*c=='&') || (*c=='<'))
+       doNotBreak = TRUE;
+    if (*c==';' || (*c =='>'))
+       doNotBreak = FALSE;
+
+    printf("%c", *c);
+    if (i % distance == 0 && ! doNotBreak) 
+        printf("<wbr>");
+    c++;
+    i++;
+    }
+}
+
 void doMiddle()
 /* Generate body of HTML. */
 {
 char *track = cartString(cart, "g");
 char *item = cloneString(cartOptionalString(cart, "i"));
 char *parentWigMaf = cartOptionalString(cart, "parentWigMaf");
 struct trackDb *tdb = NULL;
 
 
 if (hIsGisaidServer())
     {
     validateGisaidUser(cart);
     }
 
 /*	database and organism are global variables used in many places	*/