3607635bd5f7e1f690f7a93ef30e9530387f817b
braney
  Tue Sep 29 10:58:30 2026 -0700
cart: keep hgPcrResult_imgOrd, the PCR track's place after a drag, refs #38442

The check on hgPcrResult_<db> matches the hgPcrResult_ prefix, and hgPcrResult
is also the name of the track that shows the result.  So when a user dragged
any track, the cart dropped hgPcrResult_imgOrd on the next load, and the PCR
track went back to the bottom of the image on every zoom or scroll.  Exclude
that name exactly, the way hgPcrResult_targetStyle is already excluded.

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index e239216bf5c..41856a4aa35 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -270,33 +270,35 @@
 }
 
 static boolean cartVarHoldsUrlOrFileName(char *var)
 /* Return TRUE if var is one of the cart variables that may hold either. */
 {
 int i;
 for (i = 0;  i < ArraySize(urlOrFileNameCartVars);  i++)
     if (sameString(var, urlOrFileNameCartVars[i]))
         return TRUE;
 return FALSE;
 }
 
 static boolean cartVarHoldsFileNamePair(char *var)
 /* Return TRUE if var is one of the variables that hold a pair of file names.
  * hgPcrResult_targetStyle is a display setting that shares the hgPcrResult_ prefix with the
- * per-db result variables, so it is excluded by name. */
+ * per-db result variables, so it is excluded by name.  So is hgPcrResult_imgOrd: hgPcrResult
+ * is also the name of the track, and that is where hgTracks saves the track's place in the
+ * image after a drag.  refs #38442 */
 {
-if (sameString(var, PCR_RESULT_TARGET_STYLE))
+if (sameString(var, PCR_RESULT_TARGET_STYLE) || sameString(var, PCR_RESULT_TRACK_NAME "_imgOrd"))
     return FALSE;
 int i;
 for (i = 0;  i < ArraySize(fileNamePairCartVarPrefixes);  i++)
     if (startsWith(fileNamePairCartVarPrefixes[i], var))
         return TRUE;
 return FALSE;
 }
 
 static boolean fileNamePairIsAcceptable(char *val)
 /* Return TRUE if the first two whitespace-separated words of val both name a file the server
  * made for this user.  Any other shape is refused: the code that reads this value errAborts
  * on fewer than two words, and reads no more than three. */
 {
 char *dupe = cloneString(val);
 char *words[4];