On Mon, Aug 6, 2012 at 12:18 AM, Johannes Schlüter <johan...@schlueters.de>wrote:
> On Sat, 2012-08-04 at 21:49 +0200, Ferenc Kovacs wrote: > > Hi, > > > > As most of you know, the current php interactive shell is pretty much > > useless without compiling php --with-readline, but for the most users > this > > the first impression what they experience (eg. using the php interactive > > shell without readline support). > > Note that for 5.4 I refactored the code so a shared readline extension > is good enough by moving all shell related parts to ext/readline. This > should reduce the pain for distribution package users where typically > everything is shared. > for the record that would be https://bugs.php.net/bug.php?id=53878 and http://git.php.net/?p=php-src.git;a=commit;h=6c734a6b4c9ecf90162cf53fcf5f89864ccabbde right? > > > There is an alternative readline replacement called linenoise ( > > https://github.com/antirez/linenoise/) written by the author of Redis, > and > > I would like to know, what do you think about using that for the > > interactive shell if php is built without readline support. > > It is really small/compact and it is under the two clause BSD license so > I > > think it would be a good candidate for bundling it in php. > > What do you think about it? Is it something worth looking into? > > There are two ways to do that: Either move the shell code back to > sapi/cli or making ext/readline play nice with linenoise. > I have to grasp the code a little bit better to answer that, but from a quick look I think that it was an improvement, that the readline stuff was moved out from there, so I think that we should keep that. The linenoise would be always available and I think it would be only a couple of lines, so I think that it would be possible to put it into php_cli.c but as you mentioned we should make it such a way, that even the dynamically loaded readline has to be able to override it. > > When using the first approach make sure that the user can still pick > readline, as readline has features linenoise (currently) hasn't, like > searching using Ctrl+r or configuration of the key combinations. agree, linenoise can't replace readline, so in general I think that we should only use it, if readline isn't available. > I'd > also like if readline can be built shared but still overwrite the > built-in default. > agree > > Doing the second approach has the benefit that the lib can be exported > to userland in the same run. While then there's little benefit as it all > still depends on an extension ... > > (Actually there would be a third possibility - writing a linenoise > extension which uses sapi/cli's hook but that requires duplicating most > of the shell code and makes things more complicated, let#s ignore > this ;-) ) > > What's your plan there? > > to tell you the truth I'm just throwing around ideas and waiting for somebody with better understanding the actual implementation to help me out. ;) -- Ferenc Kovács @Tyr43l - http://tyrael.hu