diff options
| author | Bruce Momjian <bruce@momjian.us> | 2006-03-21 13:38:12 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2006-03-21 13:38:12 +0000 |
| commit | af00c04c42a1f9da25946f001d60941e43801285 (patch) | |
| tree | 9ecdb1effb92bd7f2bb996788ff1a992fb699dc9 /src/bin/psql/mainloop.c | |
| parent | 3b7e2b140e48ba798b29835e4c86175133e27793 (diff) | |
Fix psql history handling:
> 1) Fix the problems with the \s command.
> When the saveHistory is executed by the \s command we must not do the
> conversion \n -> \x01 (per
> http://archives.postgresql.org/pgsql-hackers/2006-03/msg00317.php )
>
> 2) Fix the handling of Ctrl+C
>
> Now when you do
> wsdb=# select 'your long query here '
> wsdb-#
> and press afterwards the CtrlC the line "select 'your long query here
'"
> will be in the history
>
> (partly per
> http://archives.postgresql.org/pgsql-hackers/2006-03/msg00297.php )
>
> 3) Fix the handling of commands with not closed brackets, quotes,
double
> quotes. (now those commands are not splitted in parts...)
>
> 4) Fix the behaviour when SINGLELINE mode is used. (before it was
almost
> broken ;(
Sergey E. Koposov
Diffstat (limited to 'src/bin/psql/mainloop.c')
| -rw-r--r-- | src/bin/psql/mainloop.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index 2992fdc3f15..edaa372c60d 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2006, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.73 2006/03/06 15:09:04 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.74 2006/03/21 13:38:12 momjian Exp $ */ #include "postgres_fe.h" #include "mainloop.h" @@ -112,7 +112,7 @@ MainLoop(FILE *source) slashCmdStatus = PSQL_CMD_UNKNOWN; prompt_status = PROMPT_READY; if (pset.cur_cmd_interactive) - pg_clear_history(history_buf); + pg_write_history(history_buf->data); if (pset.cur_cmd_interactive) putc('\n', stdout); @@ -321,7 +321,8 @@ MainLoop(FILE *source) break; } - if (pset.cur_cmd_interactive && prompt_status != PROMPT_CONTINUE) + if ((pset.cur_cmd_interactive && prompt_status == PROMPT_READY) || + (GetVariableBool(pset.vars, "SINGLELINE") && prompt_status == PROMPT_CONTINUE)) { /* * Pass all the contents of history_buf to readline |
