cab086b2e8ca3940ed301f075efbe8599ca0f8a8
larrym
  Mon Dec 12 09:51:12 2011 -0800
fix repeatMasker display bug (redmin #6275)
diff --git src/hg/hgTracks/rmskTrack.c src/hg/hgTracks/rmskTrack.c
index 661b3c8..37dc73f 100644
--- src/hg/hgTracks/rmskTrack.c
+++ src/hg/hgTracks/rmskTrack.c
@@ -100,30 +100,31 @@
 	char class[256];
 	// Simplify repClass for lookup: strip trailing '?', simplify *RNA to RNA:
 	safecpy(class, sizeof(class), ro.repClass);
 	char *p = &(class[strlen(class)-1]);
 	if (*p == '?')
 	    *p = '\0';
 	if (endsWith(class, "RNA"))
 	    safecpy(class, sizeof(class), "RNA");
 	ri = hashFindVal(hash, class);
 	if (ri == NULL)
 	   ri = otherRepeatItem;
 	percId = 1000 - ro.milliDiv - ro.milliDel - ro.milliIns;
 	grayLevel = grayInRange(percId, 500, 1000);
 	col = shadesOfGray[grayLevel];
 	x1 = roundingScale(ro.genoStart-winStart, width, baseWidth)+xOff;
+	x1 = max(x1, 0);
 	x2 = roundingScale(ro.genoEnd-winStart, width, baseWidth)+xOff;
 	w = x2-x1;
 	if (w <= 0)
 	    w = 1;
 	hvGfxBox(hvg, x1, ri->yOffset, w, heightPer, col);
 	if (baseWidth <= 100000)
 	    {
 	    if (ri == otherRepeatItem)
 		{
 		sprintf(statusLine, "Repeat %s, family %s, class %s",
 		    ro.repName, ro.repFamily, ro.repClass);
 		}
 	    else
 		{
 		sprintf(statusLine, "Repeat %s, family %s",