a6177bc07e5dbb520e06cd0b341036efc2ecd3b3
angie
  Tue Mar 6 14:23:29 2018 -0800
In hgFind, when adding a highlight via URL that the user clicks on, use a new cart variable addHighlight instead of appending to the current highlight string because that can get too long for a URL.  refs #21056

diff --git src/hg/lib/hgFind.c src/hg/lib/hgFind.c
index 88783b2..e8b53d6 100644
--- src/hg/lib/hgFind.c
+++ src/hg/lib/hgFind.c
@@ -2441,31 +2441,31 @@
 		// composite and this subTrack visible
 		if (tdb->parent)
 		    {
 		    if (tdbIsSuperTrackChild(tdb))
 			fprintf(f, "%s=show&", tdb->parent->track);
 		    else
 			{
 			// tdb is a subtrack of a composite or a view
 			fprintf(f, "%s_sel=1&", trackName);
 			fprintf(f, "%s_sel=1&", tdb->parent->track);
 			}
 		    }
                 if (isNotEmpty(pos->highlight))
                     {
                     char *encHighlight = cgiEncode(pos->highlight);
-                    fprintf(f, "highlight=%s&", encHighlight);
+                    fprintf(f, "addHighlight=%s&", encHighlight);
                     freeMem(encHighlight);
                     }
 		fprintf(f, "hgFind.matches=%s,\">", encMatches);
 		// Bold canonical genes. 
 		if(pos->canonical) {
 		    fprintf(f, "<B>");
 		    }
 		htmTextOut(f, pos->name);
 		if(pos->canonical) {
 		    fprintf(f, "</B>");
 		    }
 		fprintf(f, " at %s</A>", range);
 		desc = pos->description;
 		if (desc)
 		    {
@@ -2736,48 +2736,30 @@
     }
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 slReverse(&xrefList);
 if (xrefList == NULL && hgFindSpecSetting(hfs, "searchBoth") != NULL)
     xrefList = slPairNew(cloneString(""), cloneString(term));
 return(xrefList);
 }
 
 static char *addHighlight(struct cart *cart, char *db, char *chrom, unsigned start, unsigned end)
 /* Add the given region to the existing value of the cart variable highlight.
  * Return new value for highlight, or NULL if no change is necessary (already highlighted). */
 {
 char *color = "fcfcac";
 struct dyString *dy = dyStringCreate("%s.%s:%u-%u#%s", db, chrom, start+1, end, color);
-boolean alreadySet = FALSE;
-char *existing = cartOptionalString(cart, "highlight");
-if (isNotEmpty(existing))
-    {
-    // Don't add region if it is already in the existing highlight setting.
-    char *alreadyIn = strstr(existing, dyStringContents(dy));
-    if (alreadyIn &&
-        (alreadyIn[dyStringLen(dy)] == '|' || alreadyIn[dyStringLen(dy)] == '\0'))
-        alreadySet = TRUE;
-    else
-        dyStringPrintf(dy, "|%s", existing);
-    }
-if (alreadySet)
-    {
-    dyStringFree(&dy);
-    return NULL;
-    }
-else
 return dyStringCannibalize(&dy);
 }
 
 static boolean doQuery(char *db, struct hgFindSpec *hfs, char *xrefTerm, char *term,
 		       struct hgPositions *hgp,
 		       boolean relativeFlag, int relStart, int relEnd,
 		       boolean multiTerm, int limitResults)
 /* Perform a query as specified in hfs, assuming table existence has been 
  * checked and xref'ing has been taken care of. */
 {
 struct slName *tableList = hSplitTableNames(db, hfs->searchTable);
 struct slName *tPtr = NULL;
 struct hgPosTable *table = NULL;
 struct hgPos *pos = NULL;
 struct sqlConnection *conn = hAllocConn(db);
@@ -3274,31 +3256,31 @@
                     {
                     if (limitResults != EXHAUSTIVE_SEARCH_REQUIRED && matchCount++ >= limitResults)
                         break;
                     dyStringPrintf(hgpMatchNames, "%s,", pos->browserName);
                     }
                 }
             }
         cartSetString(cart, "hgFind.matches", hgpMatchNames->string);
         }
     }
 slReverse(&hgp->tableList);
 if (multiTerm)
     collapseSamePos(hgp);
 fixSinglePos(hgp);
 if (cart && hgp->singlePos && isNotEmpty(hgp->singlePos->highlight))
-    cartSetString(cart, "highlight", hgp->singlePos->highlight);
+    cartSetString(cart, "addHighlight", hgp->singlePos->highlight);
 return hgp;
 }
 
 
 void hgPositionsHelpHtml(char *organism, char *database)
 /* Display contents of dbDb.htmlPath for database, or print an HTML comment 
  * explaining what's missing. */
 {
 char *htmlPath = hHtmlPath(database);
 char *htmlString = NULL;
 size_t htmlStrLength = 0;
 
 if (strstrNoCase(organism, "zoo")) 
     webNewSection("About the NISC Comparative Sequencing Program Browser");
 else