]> granicus.if.org Git - postgresql/commitdiff
[ Have readline save edit history.]
authorBruce Momjian <bruce@momjian.us>
Thu, 13 Feb 2003 04:08:16 +0000 (04:08 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 13 Feb 2003 04:08:16 +0000 (04:08 +0000)
>
> > I already posted a one-line patch to implement this, but it doesn't
> > seem to hve come through to the list. Here it is inline, instead of as
> > an attachment:
>
> We need this to work without readline as well.  (Of course there won't be
> any history, but it needs to compile.)

<blush> Even after slogging my way through the nesting #ifdefs for readline
and win32, I forgot! Let's make that a three line patch, then.

Ross J. Reedstrom

src/bin/psql/command.c

index 08beb9fda88f43f748aa884b173febe03545c945..5b727b06bd5b74a65b864d97454565bca7ff119b 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.88 2003/01/10 21:57:44 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.89 2003/02/13 04:08:16 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -1648,6 +1648,9 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
                                error = true;
                        }
 
+#ifdef USE_READLINE
+                       replace_history_entry(where_history(),query_buf->data,NULL);
+#endif
                        fclose(stream);
                }