NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/54022: libedit: compatibility support for rl_completion_append_character



>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';



Home | Main Index | Thread Index | Old Index