X-Git-Url: https://git.distorted.org.uk/~mdw/xtoys/blobdiff_plain/715c9c3948c4ac0002faafe1c4713a2ad107562c..9a53569b420bfeff0a4de398893fde04d5808ab8:/xgetline.c diff --git a/xgetline.c b/xgetline.c index 96c9e46..8f8a8dc 100644 --- a/xgetline.c +++ b/xgetline.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: xgetline.c,v 1.7 1998/12/11 09:53:02 mdw Exp $ + * $Id: xgetline.c,v 1.9 1999/05/05 18:54:37 mdw Exp $ * * Fetch a line of text from the user * @@ -29,6 +29,12 @@ /*----- Revision history --------------------------------------------------* * * $Log: xgetline.c,v $ + * Revision 1.9 1999/05/05 18:54:37 mdw + * Keep blank lines out of the history list. + * + * Revision 1.8 1998/12/16 19:58:53 mdw + * Stop the dropdown list from dropping down when you press enter. + * * Revision 1.7 1998/12/11 09:53:02 mdw * Updates for mLib/mgLib. Support history files for recalling past * entries, using a drop-down list. @@ -366,6 +372,7 @@ int main(int argc, char *argv[]) } gtk_combo_set_case_sensitive(GTK_COMBO(combo), 1); gtk_combo_set_use_arrows_always(GTK_COMBO(combo), 1); + gtk_combo_disable_activate(GTK_COMBO(combo)); if (strcmp(dfl, "@") == 0) gtk_entry_set_text(GTK_ENTRY(entry), hist ? (char *)hist->data : ""); else @@ -426,10 +433,11 @@ int main(int argc, char *argv[]) /* --- If history is enabled, output a new history file --- * * - * If the first entry was accepted verbatim, don't bother. + * If the first entry was accepted verbatim, or if the entry is a blank + * line, don't bother. */ - if (f & f_history && !(hist && strcmp(p, hist->data) == 0)) { + if (f & f_history && *p && !(hist && strcmp(p, hist->data) == 0)) { int fd; FILE *fp; int i; @@ -446,7 +454,7 @@ int main(int argc, char *argv[]) fputc('\n', fp); for (i = 1, g = hist; (histmax < 1 || i < histmax) && g; g = g->next) { - if (strcmp(g->data, p) != 0) { + if (*(char *)g->data && strcmp(g->data, p) != 0) { fputs(g->data, fp); fputc('\n', fp); i++;