Closed stepa2 closed 1 year ago
Hi, thank you for opening this issue. Could you please check these details:
chat.AddText
?It works with no third-party chat addons installed.
I am pretty sure that is because RichText
or what control is used in engine supports tabulation rendering.
Are you in x64 or default?
dev
branch
After testing and asking multiple people, heres what I found:
On default branches (no chromium): Tab chars work but they are rendered as spaces by the RichText
engine panels.
On x64 (with modern RichText): The tab chars are turned into spaces. This might be a side-effect of the pre
html tag that's used by RichTextX
.
I'm not sure whether replacing \t
by 4 or 6 spaces in these panels is a good idea, if you want to copy something it might look weird if it's done. Can't see how to fix this otherwise as both problems come from things I do not have control over.
It is probable that surface
text drawing functions not handle tabs.
https://github.com/Earu/EasyChat/blob/5b8601ab82a0abdded61c6ea74b12bc386441366/lua/easychat/chathud.lua#L608-L611
One way to handle tabs is to separate text in tab-only parts and tab-less parts.
When you find tab-only part, you don't need to render that part, just render next (tab-less) part on position
round(start_of_tabs + tab_count * tab_size, tab_size)
.
Note that you can't just use math.Round
here, you need
local function round(num, roundval) return math.Round(num / roundval) * roundval end
It's not the surface library, the chat hud renders tabulations properly, it stems from the chatbox UI components
E.g. following E2 code displays as 'FirstSecondThird' in chat but 'First Second Third' in console.