NetBSD Problem Report #54022

From www@NetBSD.org  Tue Feb 26 23:47:18 2019
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0F26F7A1AB
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 26 Feb 2019 23:47:18 +0000 (UTC)
Message-Id: <20190226234716.F0D6A7A1EC@mollari.NetBSD.org>
Date: Tue, 26 Feb 2019 23:47:16 +0000 (UTC)
From: jperkins+netbsd@google.com
Reply-To: jperkins+netbsd@google.com
To: gnats-bugs@NetBSD.org
Subject: libedit: compatibility support for rl_completion_append_character
X-Send-Pr-Version: www-1.0

>Number:         54022
>Category:       lib
>Synopsis:       libedit: compatibility support for rl_completion_append_character
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 26 23:50:00 +0000 2019
>Originator:     Jonathan Perkins
>Release:        Sources as of 2019/02/26
>Organization:
Google
>Environment:
>Description:
I'd like to add support for rl_completion_suppress_append for compatibility.

In readline, rl_completion_suppress_append exists to disable the append of a space after a tab completed string.

Although similar behavior can be achieved by setting rl_completion_append_character to '\0', readline frequently resets rl_completion_append_character to ' ', and so rl_completion_suppress_append is a more durable way to set the behavior.
>How-To-Repeat:
When selecting an item via tab completion, default behavior is to append a ' ' after the selected entry.  When rl_completion_suppress_append is set to 1, nothing should be appended.
>Fix:
--- old/src/lib/libedit/readline/readline.h
+++ new/src/lib/libedit/readline/readline.h
@@ -117,6 +117,7 @@
 extern int		rl_completion_query_items;
 extern const char	*rl_special_prefixes;
 extern int		rl_completion_append_character;
+extern int		rl_completion_suppress_append;
 extern int		rl_inhibit_completion;
 extern Function		*rl_pre_input_hook;
 extern Function		*rl_startup_hook;
--- old/src/lib/libedit/readline.c
+++ new/src/lib/libedit/readline.c
@@ -158,6 +158,11 @@
  */
 int rl_completion_append_character = ' ';

+/*
+ * Set to 1 to suppress rl_completion_append_character on tab completion.
+ */
+int rl_completion_suppress_append = 0;
+
 /* stuff below is used internally by libedit for readline emulation */

 static History *h = NULL;
@@ -1857,6 +1862,9 @@
 _rl_completion_append_character_function(const char *dummy
     __attribute__((__unused__)))
 {
+	if (rl_completion_suppress_append) {
+		return "";
+	}
 	static char buf[2];
 	buf[0] = (char)rl_completion_append_character;
 	buf[1] = '\0';

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.