@@ -2,13 +2,12 @@ Subject: Fix phpdbg prompt with editline/readline integration
22
33When building phpdbg SAPI with libedit/readline integration, also start
44and end ignore characters need to be added in the prompt pattern. This
5- should work now for libedit, readline, and phpdbg without
6- readline/libedit.
5+ should work for libedit, readline, and phpdbg without readline/libedit.
76
87The RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE macros are checked
9- there to ensure libedit has these available. Otherwise, this could be
10- further improved by concatenating strings and literal strings into
11- single argument or similar using these two symbols directly.
8+ to ensure libedit has these available. Otherwise, this could be further
9+ improved by concatenating strings and literal strings into single
10+ argument or similar using these two symbols directly.
1211
1312Autotools:
1413
@@ -29,7 +28,7 @@ terminals.
2928 1 file changed, 7 insertions(+), 3 deletions(-)
3029
3130diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
32- index 964d82ef6c..4ade8777bb 100644
31+ index 964d82ef6c..944db08188 100644
3332--- a/sapi/phpdbg/phpdbg_utils.c
3433+++ b/sapi/phpdbg/phpdbg_utils.c
3534@@ -318,10 +318,14 @@ PHPDBG_API const char *phpdbg_get_prompt(void) /* {{{ */
@@ -40,13 +39,13 @@ index 964d82ef6c..4ade8777bb 100644
4039- /* TODO: libedit doesn't seems to support coloured prompt */
4140+ #if !defined(HAVE_LIBEDIT) || (defined(HAVE_LIBEDIT) && defined(RL_PROMPT_START_IGNORE) && defined(RL_PROMPT_END_IGNORE))
4241+ # if defined(HAVE_LIBEDIT) && defined(RL_PROMPT_START_IGNORE) && defined(RL_PROMPT_END_IGNORE)
43- + # define PHPDBG_PROMPT "\1\033[%sm\2%s\1\033[0m\2 "
42+ + # define PHPDBG_PROMPT_FORMAT "\1\033[%sm\2%s\1\033[0m\2 "
4443+ # else
45- + # define PHPDBG_PROMPT "\033[%sm%s\033[0m "
44+ + # define PHPDBG_PROMPT_FORMAT "\033[%sm%s\033[0m "
4645+ # endif
4746 if ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED)) {
4847- ZEND_IGNORE_VALUE(asprintf(&PHPDBG_G(prompt)[1], "\033[%sm%s\033[0m ",
49- + ZEND_IGNORE_VALUE(asprintf(&PHPDBG_G(prompt)[1], PHPDBG_PROMPT ,
48+ + ZEND_IGNORE_VALUE(asprintf(&PHPDBG_G(prompt)[1], PHPDBG_PROMPT_FORMAT ,
5049 PHPDBG_G(colors)[PHPDBG_COLOR_PROMPT]->code,
5150 PHPDBG_G(prompt)[0]));
5251 } else
0 commit comments