|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-06-02 03:29 UTC] christopher dot jf dot hopper at gmail dot com
Description: ------------ When adding colours to cli.prompt with \e these non-printable characters cause incorrect wrapping behaviour by the interactive shell. Steps to Reproduce ------------------ 1. Open a terminal window. 2. Ensure the terminal window is not maximized and reduce its width to around 80 columns. 3. Run the php interactive shell with `php -a` 4. Type a single, long line of code that wraps to the next line. 5. Add colors to the cli.prompt with \e as per http://php.net/manual/en/features.commandline.interactive.php#example-430 6. Try typing another long line of code that should wrap to the next line. Configure --------- This is my PHP 7 build configuration: ./configure \ --prefix=/usr/local \ --mandir=/usr/local/man \ --with-config-file-path=/usr/local/etc \ --with-config-file-scan-dir=/usr/local/etc/php.d \ --disable-cgi \ --enable-bcmath \ --enable-cli \ --enable-ftp \ --enable-mbstring \ --enable-pcntl \ --enable-phar \ --enable-shared \ --enable-zip \ --with-bz2 \ --with-curl \ --with-iconv \ --with-mcrypt \ --with-openssl \ --with-pear \ --with-readline \ --with-zlib Test script: --------------- // Execute in Interactive Shell with php -a ini_set('cli.prompt','\e[032m\v \e[031m\b \e[34m\> \e[0m'); print ini_get('cli.prompt'); echo "This is a long line that should wrap and it does when cli.prompt contains no non-printable characters"; ini_restore('cli.prompt'); ini_get('cli.prompt'); echo "This is a long line that should wrap and it does when cli.prompt contains no non-printable characters"; Expected result: ---------------- Last line typed wraps to newline. Terminal looks like this: 7.0.6 php > echo "This is a long line that should wrap and it does when cli.prompt contains no non-printable characters"; This is a long line that should wrap but it does not when the cli.prompt contains non-printable characters Actual result: -------------- last line typed wraps on itself. Terminal looks like this: t does not when the cli.prompt contains non-printable characters"; This is a long line that should wrap but it does not when the cli.prompt contains non-printable characters PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 02:00:01 2025 UTC |
Test Script: ------------ Simplified test script. // Execute in Interactive Shell with php -a ini_set('cli.prompt','\e[032m\v \e[031m\b \e[34m\> \e[0m'); print ini_get('cli.prompt'); echo "This is a long line that should wrap and it does when cli.prompt contains no non-printable characters";