summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/lua/console.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/player/lua/console.lua b/player/lua/console.lua
index 2444f3359d..01377e86ef 100644
--- a/player/lua/console.lua
+++ b/player/lua/console.lua
@@ -136,6 +136,9 @@ function ass_escape(str)
-- Precede newlines with a ZWNBSP to prevent ASS's weird collapsing of
-- consecutive newlines
str = str:gsub('\n', '\239\187\191\\N')
+ -- Turn leading spaces into hard spaces to prevent ASS from stripping them
+ str = str:gsub('\\N ', '\\N\\h')
+ str = str:gsub('^ ', '\\h')
return str
end