c1344ba327a9e1acaf267653730de9f532087c5e angie Fri Apr 4 12:31:55 2014 -0700 When we have multiple position matches, restore lastPosition(or defaultPosition). fixes #13009 diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index b7b49cf..fff3195 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -5260,43 +5260,48 @@ if (sameString(position, "")) { hUserAbort("Please go back and enter a coordinate range or a search term in the \"search term\" field.
For example: chr22:20100000-20200000.\n"); } chromName = NULL; winStart = 0; if (isGenome(position) || NULL == (hgp = findGenomePos(database, position, &chromName, &winStart, &winEnd, cart))) { if (winStart == 0) /* number of positions found */ { freeMem(position); position = cloneString(cartUsualString(cart, "lastPosition", defaultPosition)); hgp = findGenomePos(database, position, &chromName, &winStart, &winEnd,cart); - if (hgp != NULL && position != defaultPosition) + if (hgp != NULL && differentString(position, defaultPosition)) cartSetString(cart, "position", position); } } /* After position is found set up hash of matches that should be drawn with names highlighted for easy identification. */ createHgFindMatchHash(); /* This means that no single result was found I.e., multiple results may have been found and are printed out prior to this code*/ if (NULL == chromName) { + // In case user manually edits the browser location as described in #13009, + // revert the position. If they instead choose from the list as we expect, + // that will set the position to their choice. + char *lastPosition = cartUsualString(cart, "lastPosition", hDefaultPos(database)); + cartSetString(cart, "position", lastPosition); return; } seqBaseCount = hChromSize(database, chromName); winBaseCount = winEnd - winStart; /* Figure out basic dimensions of display. This * needs to be done early for the sake of the * zooming and dinking routines. */ setLayoutGlobals(); baseShowPos = cartUsualBoolean(cart, BASE_SHOWPOS, FALSE); baseShowAsm = cartUsualBoolean(cart, BASE_SHOWASM, FALSE); baseShowScaleBar = cartUsualBoolean(cart, BASE_SCALE_BAR, TRUE); baseShowRuler = cartUsualBoolean(cart, BASE_SHOWRULER, TRUE);