ae751438b669c74fd5809bfed90f725037f60417
braney
  Fri Jul 30 16:18:11 2021 -0700
add support for second page of help results to hgTables and hgVai. Move
"no results" printf to library.
Change comment in hgTables/identifiers.c to make more sense.

diff --git src/hg/hgVai/hgVai.c src/hg/hgVai/hgVai.c
index 109760f..03364f8 100644
--- src/hg/hgVai/hgVai.c
+++ src/hg/hgVai/hgVai.c
@@ -3041,44 +3041,53 @@
 getDbAndGenome(cart, &database, &genome, oldVars);
 initGenbankTableNames(database);
 regionType = cartUsualString(cart, hgvaRegionType, hgvaRegionTypeGenome);
 if (isEmpty(cartOptionalString(cart, hgvaRange)))
     cartSetString(cart, hgvaRange, hDefaultPos(database));
 
 int timeout = cartUsualInt(cart, "udcTimeout", 300);
 if (udcCacheTimeout() < timeout)
     udcSetCacheTimeout(timeout);
 knetUdcInstall();
 
 char *range = trimSpaces(windowsToAscii(cartUsualString(cart, hgvaRange, "")));
 cartSetLastPosition(cart, range, oldVars);
 cartTrackDbInit(cart, &fullTrackList, &fullGroupList, TRUE);
 struct dyString *dyWarn = dyStringNew(0);
+boolean noShort = (cartOptionalString(cart, "noShort") != NULL); // is this the second page of results
 struct hgPositions *hgp = lookupPosition(dyWarn);
-if (hgp->singlePos && isEmpty(dyWarn->string))
+if (hgp->singlePos && isEmpty(dyWarn->string) && !noShort)
     {
     if (startQuery)
 	doQuery();
     else if (! isCommandLine)
 	doUi();
     }
 else
     {
     if (startQuery)
         // Need Content-type (html)
         cartWebStartHeader(cart, database, "Variant Annotation Integrator");
     else
         cartWebStart(cart, database, "Variant Annotation Integrator");
     if (isNotEmpty(dyWarn->string))
+        {
+        if (noShort) // we're on the second page of results
+            hgp->posCount = 0;  // hgFindSearch gives us a bogus hgp if the warn string is set
+        else
             warn("%s", dyWarn->string);
-    if (hgp->posCount > 1)
+        }
+    if ((hgp->posCount > 1) || noShort) // if we're on the second page we want to put out HTML even if there are no results.
+        {
         hgPositionsHtml(database, hgp, hgVaiName(), cart);
+        cartSetString(cart, hgvaRange, range); // we need to reset the position because lookupPosition above trashes it
+        }
     else
         doMainPage();
     cartWebEnd();
     }
 
 cartCheckout(&cart);
 if (! isCommandLine)
     cgiExitTime("hgVai", enteredMainTime);
 return 0;
 }