psql tab completion: fix COMMENT ON ... IS IS IS

Started by Ian Barwickabout 11 years ago3 messages
#1Ian Barwick
ian@2ndquadrant.com
1 attachment(s)

Hi

Currently tab completion for 'COMMENT ON {object} foo IS' will result in the 'IS'
being duplicated up to two times; not a world-shattering issue I know, but the
fix is trivial and I stumble over it often enough to for it to mildly annoy me.
Patch attached.

Regards

Ian Barwick

--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

psql-comment-on-is-is-is.patchtext/x-patch; name=psql-comment-on-is-is-is.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
new file mode 100644
index 82c926d..7212015
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
*************** psql_completion(const char *text, int st
*** 2130,2141 ****
  	{
  		COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers);
  	}
! 	else if ((pg_strcasecmp(prev4_wd, "COMMENT") == 0 &&
! 			  pg_strcasecmp(prev3_wd, "ON") == 0) ||
! 			 (pg_strcasecmp(prev5_wd, "COMMENT") == 0 &&
! 			  pg_strcasecmp(prev4_wd, "ON") == 0) ||
! 			 (pg_strcasecmp(prev6_wd, "COMMENT") == 0 &&
! 			  pg_strcasecmp(prev5_wd, "ON") == 0))
  		COMPLETE_WITH_CONST("IS");
  
  /* COPY */
--- 2130,2142 ----
  	{
  		COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers);
  	}
! 	else if (((pg_strcasecmp(prev4_wd, "COMMENT") == 0 &&
! 			   pg_strcasecmp(prev3_wd, "ON") == 0) ||
! 			  (pg_strcasecmp(prev5_wd, "COMMENT") == 0 &&
! 			   pg_strcasecmp(prev4_wd, "ON") == 0) ||
! 			  (pg_strcasecmp(prev6_wd, "COMMENT") == 0 &&
! 			   pg_strcasecmp(prev5_wd, "ON") == 0)) &&
! 			   pg_strcasecmp(prev_wd, "IS") != 0)
  		COMPLETE_WITH_CONST("IS");
  
  /* COPY */
#2Robert Haas
robertmhaas@gmail.com
In reply to: Ian Barwick (#1)
Re: psql tab completion: fix COMMENT ON ... IS IS IS

On Sun, Dec 28, 2014 at 7:44 PM, Ian Barwick <ian@2ndquadrant.com> wrote:

Currently tab completion for 'COMMENT ON {object} foo IS' will result in the
'IS'
being duplicated up to two times; not a world-shattering issue I know, but
the
fix is trivial and I stumble over it often enough to for it to mildly annoy
me.
Patch attached.

I've noticed that in the past, too. Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Ian Barwick
ian@2ndquadrant.com
In reply to: Robert Haas (#2)
Re: psql tab completion: fix COMMENT ON ... IS IS IS

On 15/01/01 1:07, Robert Haas wrote:

On Sun, Dec 28, 2014 at 7:44 PM, Ian Barwick <ian@2ndquadrant.com> wrote:

Currently tab completion for 'COMMENT ON {object} foo IS' will result in the
'IS'
being duplicated up to two times; not a world-shattering issue I know, but
the
fix is trivial and I stumble over it often enough to for it to mildly annoy
me.
Patch attached.

I've noticed that in the past, too. Committed.

Thanks.

Regards

Ian Barwick

--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers