Skip to content

Commit

Permalink
Trim chat text and check subpanel validity (#424)
Browse files Browse the repository at this point in the history
Co-authored-by: Riggs <49407096+RiggsMackay@users.noreply.github.com>
riggs9162 and riggs9162 authored Apr 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3b005b3 commit 5bbfad4
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gamemode/core/derma/cl_subpanel.lua
Original file line number Diff line number Diff line change
@@ -286,12 +286,20 @@ end

function PANEL:Paint(width, height)
for i = 1, #self.childPanels do
if not (IsValid(self.childPanels[i])) then
continue
end

self.childPanels[i]:PaintManual()
end
end

function PANEL:PaintSubpanels(width, height)
for i = 1, #self.subpanels do
if not (IsValid(self.subpanels[i])) then
continue
end

self.subpanels[i]:PaintManual()
end
end
6 changes: 6 additions & 0 deletions gamemode/core/libs/sh_chatbox.lua
Original file line number Diff line number Diff line change
@@ -333,6 +333,9 @@ if (SERVER) then
local rawText = text
local maxLength = ix.config.Get("chatMax")

-- Trim the text and remove extra spaces.
text = string.gsub(text, "%s+", " ")

if (text:utf8len() > maxLength) then
text = text:utf8sub(0, maxLength)
end
@@ -359,6 +362,9 @@ else
local class = ix.chat.classes[chatType]

if (class) then
-- Trim the text and remove extra spaces.
text = string.gsub(text, "%s+", " ")

-- luacheck: globals CHAT_CLASS
CHAT_CLASS = class
class:OnChatAdd(speaker, text, anonymous, data)

0 comments on commit 5bbfad4

Please sign in to comment.