commit 87af2a24bea9ec5983cf3dbf926d94f3dc91b5c4
parent b20bdba94730f7fc92585b6bcde37bb416128fad
Author: Michael Savage <mikejsavage@gmail.com>
Date: Tue, 1 Apr 2014 22:34:03 +0100
Fix missing newlines in output
Diffstat:
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/handlers.lua b/handlers.lua
@@ -12,6 +12,7 @@ local fg = 7
local bg = 0
local lastWasChat = false
+local lastWasGA = false
local receiving = false
local showInput = true
@@ -69,15 +70,18 @@ local function printPendingInputs()
for i = 1, #pendingInputs do
mud.printr( pendingInputs[ i ] )
+
+ lastWasGA = false
end
pendingInputs = { }
end
local function handleChat( message )
- if not message then
- lastWasChat = true
+ lastWasChat = true
+ lastWasGA = false
+ if not message then
return
end
@@ -126,8 +130,6 @@ local function handleChat( message )
fg = oldFG
bg = oldBG
bold = oldBold
-
- lastWasChat = true
end
local function handleData( data )
@@ -148,6 +150,14 @@ local function handleData( data )
dataBuffer = dataBuffer .. "\n"
for line in dataBuffer:gmatch( "([^\n]*)\n" ) do
+ if lastWasGA then
+ if line ~= "" then
+ mud.newlineMain()
+ end
+
+ lastWasGA = false
+ end
+
if lastWasChat then
mud.newlineMain()
@@ -185,6 +195,7 @@ local function handleData( data )
end
if hasGA then
+ lastWasGA = true
printPendingInputs()
end
@@ -219,6 +230,8 @@ local function handleCommand( input, hide )
lastWasChat = false
end
+ lastWasGA = false
+
mud.printr( toShow )
end
end