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/lib/hgFind.c src/hg/lib/hgFind.c
index d0a06bf..892d9fb 100644
--- src/hg/lib/hgFind.c
+++ src/hg/lib/hgFind.c
@@ -1985,30 +1985,37 @@
 void hgPositionsHtml(char *db, struct hgPositions *hgp, char *hgAppName, struct cart *cart)
 /* Write multiple search results as HTML. */
 {
 struct hgPosTable *table;
 struct hgPos *pos;
 char *desc;
 char range[HGPOSRANGESIZE];
 char *ui = getUiUrl(cart);
 char *extraCgi = hgp->extraCgi;
 char hgAppCombiner = (strchr(hgAppName, '?')) ? '&' : '?';
 boolean containerDivPrinted = FALSE;
 struct trackDb *tdbList = NULL;
 // This used to be an argument, but only stdout was used:
 FILE *f = stdout;
 
+if (hgp->posCount == 0)
+    {
+    fprintf(f, "<div id='hgFindResults'>\n");
+    fprintf(f, "<p>No additional items found</p>");
+    fprintf(f, "</div>\n");
+    return;
+    }
 for (table = hgp->tableList; table != NULL; table = table->next)
     {
     if (table->posList != NULL)
 	{
 	char *tableName = table->name;
 	if (startsWith("all_", tableName))
 	    tableName += strlen("all_");
 
 	// clear the tdb cache if this track is a hub track
 	if (isHubTrack(tableName))
 	    tdbList = NULL;
 	struct trackDb *tdb = tdbForTrack(db, tableName, &tdbList);
 	if (!tdb)
             errAbort("no track for table \"%s\" found via a findSpec", tableName);
 	char *trackName = tdb->track;
@@ -2078,31 +2085,37 @@
 		    }
 		fprintf(f, "\n");
 		freeMem(encMatches);
 		}
 	    }
 	if (table->htmlEnd) 
 	    table->htmlEnd(table, f);
 	else
 	    fprintf(f, "</PRE>\n");
 	}
     }
 
 if(containerDivPrinted)
     {
     if (hgp->shortCircuited)
-        fprintf(f, "<A HREF=\"%s?%s&noShort=1\"> More results...</A>", hgTracksName(), getenv("QUERY_STRING"));
+        {
+        char *queryString = getenv("QUERY_STRING");
+        char *addString = "&noShort=1";
+        if (isEmpty(queryString))
+            addString = "noShort=1";
+        fprintf(f, "<A HREF=\"%s?%s%s\"> More results...</A>", hgAppName, queryString, addString);
+        }
     fprintf(f, "</div>\n");
     }
 }
 
 static struct hgPositions *hgPositionsSearch(char *db, char *spec,
                                              char **retChromName, int *retWinStart, int *retWinEnd,
                                              boolean *retIsMultiTerm, struct cart *cart,
                                              char *hgAppName, char **retMultiChrom,
                                              struct dyString *dyWarn)
 /* Search for positions that match spec (possibly ;-separated in which case *retIsMultiTerm is set).
  * Return a container of tracks and positions (if any) that match term.  If different components
  * of a multi-term search land on different chromosomes then *retMultiChrom will be set. */
 {
 struct hgPositions *hgp = NULL;
 char *chrom = NULL;