da2089fb286b3119d62399a747a23fc22fa3ad70
chmalee
  Wed Mar 18 16:53:36 2026 -0700
Add plain position searches to the recents search stack on hgTracks/hgGateway, refs #34588

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index e4b73beda03..bc6c8e01b31 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -5072,30 +5072,35 @@
             var gnomadVarMatch = newPos.match(gnomadVarExp);
             var positionMatch = canonMatch || gbrowserMatch || lengthMatch || bedMatch || sqlMatch || singleMatch || gnomadRangeMatch || gnomadVarMatch;
             if (positionMatch === null) {
                 // user may have entered a full chromosome name, check for that asynchronosly:
                 $.ajax({
                     type: "GET",
                     url: "../cgi-bin/hgSearch",
                     data: cart.varsToUrlData({ 'cjCmd': '{"getChromName": {"db": "' + getDb() + '", "searchTerm": "' + term + '"}}' }),
                     dataType: "json",
                     trueSuccess: onSuccess,
                     success: onSuccess,
                     error: onFail,
                     cache: true
                 });
                 return false;
+            } else {
+                // about to do a form submit with a regular position range, save this to the recents stack
+                // strip any html content first
+                newPos = newPos.replace(/<[^>]*>/g, '');
+                addRecentSearch(getDb(), newPos, {id: newPos, value: newPos, label: newPos});
             }
                 
             return true;
         });
         // Have vis box changes update cart through ajax.  This helps keep page/cart in sync.
         vis.initForAjax();
 
         // We reach here from these possible paths:
         // A) Forward: Full page retrieval: hgTracks is first navigated to (or chrom change)
         // B) Back-button past a full retrieval (B in: ->A,->b,->c(full page),->d,<-c,<-B(again))
         //    B1) Dirty page: at least one non-position change (e.g. 1 track vis changed in b)
         //    B2) Clean page: only position changes from A->b->| 
         var curPos = encodeURIComponent(genomePos.get().replace(/,/g,''));
         var curDbPos = hgTracks.lastDbPos;
         var cachedPos = imageV2.history.getState().data.position;