
On Thu, Oct 06, 2005 at 04:59:00PM +0100, Neil Mitchell wrote:
Regarding interact and getLine, the behaviour is unchanged from previous versions of WinHugs, and Hugs on Windows. However, older versions on Solaris do echo the input. Looking at GHCi, it echos by line, not by character. If someone gives me a spec, or at least a hint as to what the right behaviour is I will implement it :)
Under Unix, echoing is left to the OS. The usual OS setting is to echo by characters. I thought plain hugs running in a Windows console window did this too, but haven't checked. (Older versions of Hugs turned off OS echoing and echoed to stdout themselves for getChar but not interact, which caused wierd behaviour if stdin and/or stdout were redirected.) So I'd prefer to have characters echoed as they're typed, but don't know what is the cleanest way to achieve this under WinHugs. It's also convenient that characters are line-buffered by default under Unix, because this allows users to correct their input before they hit return. On the downside, getChar doesn't execute as early as some might expect. Again no clue regarding WinHugs, but if it's messy, this isn't as important as echoing. Echoing can be controlled from within Haskell programs using System.IO.hSetEcho (calls setEchoTerminal() in machdep.c), and buffering with System.IO.hSetBuffering (calls setBuffTerminal() in machdep.c).