d9b708e09efd7a685da75ba1ffbb28a6174fb4d4 braney Fri Jul 23 15:42:06 2021 -0700 fix up hgFind search so second pass generates a search page even if there are 0 or 1 results from the non-short circuit search diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 0ce590e..4e4a34c 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -632,30 +632,31 @@ bands overlaps by one. */ if (winEnd > cb->chromStart && winEnd <= cb->chromEnd) { safef(endBand, buffSize, "%s", cb->name); } } } boolean makeChromIdeoImage(struct track **pTrackList, char *psOutput, struct tempName *ideoTn) /* Make an ideogram image of the chromosome and our position in it. If the * ideoTn parameter is not NULL, it is filled in if the ideogram is created. */ { +char *chromName = "fart"; struct track *ideoTrack = NULL; MgFont *font = tl.font; char *mapName = "ideoMap"; struct hvGfx *hvg; boolean doIdeo = TRUE; int ideoWidth = round(.8 *tl.picWidth); int ideoHeight = 0; int textWidth = 0; struct tempName pngTn; boolean nukeIdeoFromList = FALSE; if (ideoTn == NULL) ideoTn = &pngTn; // not returning value ideoTrack = chromIdeoTrack(*pTrackList); @@ -5268,31 +5269,32 @@ char *shortChromName = cloneString(chromName); safef(rulerLabel,ArraySize(rulerLabel),":%s",shortChromName); int labelWidth = mgFontStringWidth(font,rulerLabel); while ((labelWidth > 0) && (labelWidth > leftLabelWidth)) { int len = strlen(shortChromName); shortChromName[len-1] = 0; safef(rulerLabel,ArraySize(rulerLabel),":%s",shortChromName); labelWidth = mgFontStringWidth(font,rulerLabel); } if (hvgSide->rc) safef(rulerLabel,ArraySize(rulerLabel),":%s",shortChromName); else safef(rulerLabel,ArraySize(rulerLabel),"%s:",shortChromName); hvGfxTextRight(hvgSide, leftLabelX, y, leftLabelWidth-1, rulerHeight, - MG_BLACK, font, rulerLabel); + //MG_BLACK, font, rulerLabel); + MG_BLACK, font, "gart"); y += rulerHeight; freeMem(shortChromName); } if (zoomedToBaseLevel || rulerCds) { /* disable complement toggle for HIV because HIV is single stranded RNA */ drawComplementArrow(hvgSide,leftLabelX, y, leftLabelWidth-1, baseHeight, font); if (zoomedToBaseLevel) y += baseHeight; } if (rulerCds) y += rulerTranslationHeight; } for (flatTrack = flatTracks; flatTrack != NULL; flatTrack = flatTrack->next) { @@ -9403,38 +9405,54 @@ withPriorityOverride = cartUsualBoolean(cart, configPriorityOverride, FALSE); fullInsideX = trackOffsetX(); fullInsideWidth = tl.picWidth-gfxBorder-fullInsideX; } static boolean resolvePosition(char **pPosition) /* Position may be an already-resolved chr:start-end, or a search term. * If it is a search term: * 1 match ==> set globals chromName, winStart, winEnd, return TRUE. * 0 matches ==> switch back to lastPosition, hopefully get 1 match from that; * set globals chromName, winStart, winEnd, return TRUE. If no lastPosition, try w/hDefaultPos(). * multiple matches ==> Display a page with links to match positions, return FALSE. */ { boolean resolved = TRUE; struct dyString *dyWarn = dyStringNew(0); +boolean noShort = (cartOptionalString(cart, "noShort") != NULL); hgp = hgFindSearch(cart, pPosition, &chromName, &winStart, &winEnd, hgTracksName(), dyWarn); if (isNotEmpty(dyWarn->string)) + { + if (noShort) // we're on the second pass of the search + { + // tell the user we didn't find anything + char *menuStr = menuBar(cart, database); + if (menuStr) + puts(menuStr); + FILE *f = stdout; + fprintf(f, "
\n"); + fprintf(f, "

No additional items found

"); + resolved = FALSE; + } + else warn("%s", dyWarn->string); -if (hgp->singlePos) + } + +if (!noShort && hgp->singlePos) { createHgFindMatchHash(); } -else +else if (resolved) // if we haven't put out the "found nothing" text above { char *menuStr = menuBar(cart, database); if (menuStr) puts(menuStr); hgPositionsHtml(database, hgp, hgTracksName(), cart); resolved = FALSE; } cartSetString(cart, "position", *pPosition); return resolved; } void parseVirtPosition(char *position) /* parse virtual position * TODO this is just temporary */ {