summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c19
-rw-r--r--ext/readline/tests/readline_info_001.phpt14
2 files changed, 32 insertions, 1 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index bd443ebcd6..7026b020f6 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -262,6 +262,11 @@ PHP_FUNCTION(readline_info)
add_assoc_long(return_value,"pending_input",rl_pending_input);
add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt));
add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name));
+ add_assoc_str(return_value, "completion_append_character",
+ rl_completion_append_character == 0
+ ? ZSTR_EMPTY_ALLOC()
+ : ZSTR_CHAR(rl_completion_append_character));
+ add_assoc_bool(return_value,"completion_suppress_append",rl_completion_suppress_append);
#endif
#if HAVE_ERASE_EMPTY_LINE
add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line);
@@ -307,6 +312,20 @@ PHP_FUNCTION(readline_info)
RETVAL_STRING(SAFE_STRING(rl_prompt));
} else if (!strcasecmp(what, "terminal_name")) {
RETVAL_STRING((char *)SAFE_STRING(rl_terminal_name));
+ } else if (!strcasecmp(what, "completion_suppress_append")) {
+ oldval = rl_completion_suppress_append;
+ if (value) {
+ rl_completion_suppress_append = zend_is_true(value);
+ }
+ RETVAL_BOOL(oldval);
+ } else if (!strcasecmp(what, "completion_append_character")) {
+ oldval = rl_completion_append_character;
+ if (value) {
+ convert_to_string_ex(value)
+ rl_completion_append_character = (int)Z_STRVAL_P(value)[0];
+ }
+ RETVAL_INTERNED_STR(
+ oldval == 0 ? ZSTR_EMPTY_ALLOC() : ZSTR_CHAR(oldval));
#endif
#if HAVE_ERASE_EMPTY_LINE
} else if (!strcasecmp(what, "erase_empty_line")) {
diff --git a/ext/readline/tests/readline_info_001.phpt b/ext/readline/tests/readline_info_001.phpt
index 81b7806b43..68599c1d67 100644
--- a/ext/readline/tests/readline_info_001.phpt
+++ b/ext/readline/tests/readline_info_001.phpt
@@ -16,10 +16,14 @@ var_dump(readline_info('readline_name', 1));
var_dump(readline_info('readline_name'));
var_dump(readline_info('attempted_completion_over',1));
var_dump(readline_info('attempted_completion_over'));
+var_dump(readline_info('completion_append_character', "\0"));
+var_dump(readline_info('completion_append_character'));
+var_dump(readline_info('completion_suppress_append', true));
+var_dump(readline_info('completion_suppress_append'));
?>
--EXPECTF--
-array(11) {
+array(13) {
["line_buffer"]=>
string(0) ""
["point"]=>
@@ -36,6 +40,10 @@ array(11) {
string(0) ""
["terminal_name"]=>
string(0) ""
+ ["completion_append_character"]=>
+ string(1) " "
+ ["completion_suppress_append"]=>
+ bool(false)
["library_version"]=>
string(%d) "%s"
["readline_name"]=>
@@ -51,3 +59,7 @@ string(5) "other"
string(1) "1"
int(0)
int(1)
+string(1) " "
+string(0) ""
+bool(false)
+bool(true) \ No newline at end of file