From 16d246935f4598fbe8e3bee62e36841d45fb073a Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 17 Mar 2014 18:15:13 -0400 Subject: Added \r to tty writes. --- Presence/ConsoleWriter.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Presence/ConsoleWriter.hs b/Presence/ConsoleWriter.hs index e295a72b..2a77394f 100644 --- a/Presence/ConsoleWriter.hs +++ b/Presence/ConsoleWriter.hs @@ -237,6 +237,12 @@ deliverGUIMessage cw tty utmp msg = do exitImmediately ExitSuccess return True +crlf :: Text -> Text +crlf t = Text.unlines $ map cr (Text.lines t) + where + cr t | Text.last t == '\r' = t + | otherwise = t <> "\r" + deliverTerminalMessage cw tty utmp msg = do mode <- fmap fileMode (getFileStatus $ Text.unpack tty) let mesgy = mode .&. 0o020 /= 0 -- verify mode g+w @@ -245,8 +251,8 @@ deliverTerminalMessage cw tty utmp msg = do t <- messageText msg return $ Text.unpack $ case stanzaFrom msg of - Just from -> from <> " says...\n" <> t <> "\n" - Nothing -> t <> "\n" + Just from -> from <> " says...\r\n" <> crlf t <> "\r\n" + Nothing -> crlf t <> "\r\n" writeFile (Text.unpack tty) text return True -- return True if a message was delivered -- cgit v1.2.3