I recently wrote a getLine version that treats backspace correctly (you might wish to choose a better name, though :-):

-- getLine' correctly treats backspaces (erasing the deleted characters in output)
getLine' = liftM reverse $ getLine'' ""
where getLine'' read = do
c <- getChar
if c=='\n' then return read else do
if c=='\b'
then do putStr " \b"
if null read then getLine'' "" else getLine'' (tail read)
else getLine'' (c:read)


Regards,

--
Bernd Holzm�ller
______________________________________________________
INFORMATIK CONSULTING SYSTEMS AG
Sonnenbergstra�e 13               70184 Stuttgart
Telefon: +49 (0711) 21037-37      Fax: -75
mailto:[EMAIL PROTECTED]      http://www.ics-ag.de


_______________________________________________ Hugs-Users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/hugs-users

Reply via email to