diff options
author | Robert Haas | 2011-02-11 21:57:58 +0000 |
---|---|---|
committer | Robert Haas | 2011-02-11 21:57:58 +0000 |
commit | 5917574539732a6e521a6dc260fcd7c9a258d89e (patch) | |
tree | 01ec58c8d53e7e9233436929348fe88d0566b0c6 | |
parent | d309acf201ab2c5bbd1f6a5d51e4a8060eb6a63c (diff) |
Allow tab-completion of :variable even as first word on a line.
Christoph Berg
-rw-r--r-- | src/bin/psql/tab-complete.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index c01b02ae3a1..2c656068f82 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -761,6 +761,17 @@ psql_completion(char *text, int start, int end) if (text[0] == '\\') COMPLETE_WITH_LIST(backslash_commands); + /* Variable interpolation */ + else if (text[0] == ':' && text[1] != ':') + { + if (text[1] == '\'') + matches = complete_from_variables(text, ":'", "'"); + else if (text[1] == '"') + matches = complete_from_variables(text, ":\"", "\""); + else + matches = complete_from_variables(text, ":", ""); + } + /* If no previous word, suggest one of the basic sql commands */ else if (!prev_wd) COMPLETE_WITH_LIST(sql_commands); @@ -2772,17 +2783,6 @@ psql_completion(char *text, int start, int end) ) matches = completion_matches(text, filename_completion_function); -/* Variable interpolation */ - else if (text[0] == ':' && text[1] != ':') - { - if (text[1] == '\'') - matches = complete_from_variables(text, ":'", "'"); - else if (text[1] == '"') - matches = complete_from_variables(text, ":\"", "\""); - else - matches = complete_from_variables(text, ":", ""); - } - /* * Finally, we look through the list of "things", such as TABLE, INDEX and * check if that was the previous word. If so, execute the query to get a |