PR/29958: Peter Bex: add rl_variable_bind and rl_attempted_completion_over

This commit is contained in:
christos 2005-04-12 22:01:40 +00:00
parent 179747d76c
commit a76abbed58
2 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: readline.c,v 1.50 2005/04/02 06:28:10 christos Exp $ */ /* $NetBSD: readline.c,v 1.51 2005/04/12 22:01:40 christos Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include "config.h" #include "config.h"
#if !defined(lint) && !defined(SCCSID) #if !defined(lint) && !defined(SCCSID)
__RCSID("$NetBSD: readline.c,v 1.50 2005/04/02 06:28:10 christos Exp $"); __RCSID("$NetBSD: readline.c,v 1.51 2005/04/12 22:01:40 christos Exp $");
#endif /* not lint && not SCCSID */ #endif /* not lint && not SCCSID */
#include <sys/types.h> #include <sys/types.h>
@ -1762,9 +1762,13 @@ _rl_complete_internal(int what_to_do)
(end - len), end); (end - len), end);
} else } else
matches = 0; matches = 0;
if (!rl_attempted_completion_function || !matches) if (!rl_attempted_completion_function ||
(!rl_attempted_completion_over && !matches))
matches = completion_matches(temp, (CPFunction *)complet_func); matches = completion_matches(temp, (CPFunction *)complet_func);
if (rl_attempted_completion_over)
rl_attempted_completion_over = 0;
if (matches) { if (matches) {
int i, retval = CC_REFRESH; int i, retval = CC_REFRESH;
int matches_num, maxlen, match_len, match_display=1; int matches_num, maxlen, match_len, match_display=1;
@ -2096,6 +2100,16 @@ rl_parse_and_bind(const char *line)
return (argc ? 1 : 0); return (argc ? 1 : 0);
} }
int
rl_variable_bind(const char *var, const char *value)
{
/*
* The proper return value is undocument, but this is what the
* readline source seems to do.
*/
return ((el_set(e, EL_BIND, "", var, value) == -1) ? 1 : 0);
}
void void
rl_stuff_char(int c) rl_stuff_char(int c)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: readline.h,v 1.12 2004/09/08 18:15:37 christos Exp $ */ /* $NetBSD: readline.h,v 1.13 2005/04/12 22:01:40 christos Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -102,6 +102,7 @@ extern char *rl_completer_word_break_characters;
extern char *rl_completer_quote_characters; extern char *rl_completer_quote_characters;
extern Function *rl_completion_entry_function; extern Function *rl_completion_entry_function;
extern CPPFunction *rl_attempted_completion_function; extern CPPFunction *rl_attempted_completion_function;
extern int rl_attempted_completion_over;
extern int rl_completion_type; extern int rl_completion_type;
extern int rl_completion_query_items; extern int rl_completion_query_items;
extern char *rl_special_prefixes; extern char *rl_special_prefixes;
@ -174,6 +175,7 @@ void rl_prep_terminal(int);
void rl_deprep_terminal(void); void rl_deprep_terminal(void);
int rl_read_init_file(const char *); int rl_read_init_file(const char *);
int rl_parse_and_bind(const char *); int rl_parse_and_bind(const char *);
int rl_variable_bind(const char *, const char *);
void rl_stuff_char(int); void rl_stuff_char(int);
int rl_add_defun(const char *, Function *, int); int rl_add_defun(const char *, Function *, int);