<html><body>On 06:18 pm, list-ener@strank.info wrote:<br />&gt;on 04.04.2007 23:40 glyph@divmod.com said the following:<br />&gt;&lt;snip&gt;<br /><br />&gt;&gt;Run "python -m twisted/conch/stdio" for an example of an interactive <br />&lt;snip&gt;<br />&gt;&gt;Here's a screenshot of an interactive session using the command above:<br /><br />&gt;Am I right that this is a screenshot of the manhole client?<br /><br />Sort of. &#160;It's the manhole server (I don't know what you mean by "client") running on standard IO, run via 'python -m twisted/conch/stdio'.<br /><br />&gt;For embedding this in twisted, the twisted reactor needs to be the one <br />&gt;calling IPython/pyreadline when necessary.<br />&gt;On the IPython level, I think this should be "easy" by subclassing the Shell <br />&gt;and splitting/rearranging the relevant code, so that it can be called back <br />&gt;at the point where raw_input would normally return.<br />&gt;(I did not look at the new IPython saw branch...)<br /><br />&gt;On the twisted side, I think that something like twisted.internet.stdio <br />&gt;would be calling back?<br /><br />Rather than IPython calling into raw_input, the loop that calls raw_input would have to be changed to a function that takes a string. &#160;This would almost certainly be the trickiest part, since it seems there are about two dozen places (at a quick glance) in ipython that call raw_input.<br /><br />&gt;Or rather something like twisted.conch.insults?<br /><br />insults will be getting its events from twisted.internet.stdio, so both will be involved.<br /><br />&gt;I suspect that it would be hard to recode pyreadline in a way that it could <br />&gt;be called back by twisted?<br />&gt;So to get readline support, something like readline would need to be <br />&gt;implemented using t.i.stdio / insults.<br />&gt;<br />&gt;Does this seem possible, so far? :-)<br /><br />To me, sure - although I hardly have the time to do it :). &#160;There have been a few forays into line-editing code for insults, although I'm not clear of the current state of the art, JP Calderone should be returning from vacation soon and will probably have some light to shed on the issue. &#160;I don't know much about pyreadline. &#160;There may be code there that's reusable, maybe not, but in any event it is a goal of the insults library to provide high-quality event-driven line-editing.<br /></body></html>