From 70e542a4db3493fc519293caeaa401843694d201 Mon Sep 17 00:00:00 2001 From: tanghy Date: Wed, 21 Jul 2021 21:46:49 +0900 Subject: [PATCH] support tab-completion for single quote input with equal sign diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index d6bf725971..3338e4eb04 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -4984,6 +4984,7 @@ get_previous_words(int point, char **buffer, int *nwords) int start, end; bool inquotes = false; + bool in_single_quote = false; int parentheses = 0; /* now find the first non-space which then constitutes the end */ @@ -5012,6 +5013,8 @@ get_previous_words(int point, char **buffer, int *nwords) inquotes = !inquotes; if (!inquotes) { + if (buf[start] == '\'') + in_single_quote = !in_single_quote; if (buf[start] == ')') parentheses++; else if (buf[start] == '(') @@ -5020,6 +5023,7 @@ get_previous_words(int point, char **buffer, int *nwords) break; } else if (parentheses == 0 && + !in_single_quote && strchr(WORD_BREAKS, buf[start - 1])) break; } -- 2.31.1.windows.1