Make tabs display properly in TextObjects

Tl;Dr:

Tabs are smaller than or equal to a single space when displayed in a Roblox TextObject.
That’s bad behavior. Please fix.


Within a TextBox/Label/Button, "\t" is displayed the same as " ".

I was wrong. They don’t display the same. It depends on the font! It doesn’t get it right, of course, but they are different!

Within a TextBox/Label/Button, "\t" is displayed smaller than or equal to a " ".

This means that any attempt at displaying indented text does not work.


SourceSans:

image

Code:
image

Arial:
image

Gotham:
image

Why is tab smaller than space?


I know some people will say to just do global substitution to multiple spaces:

TextBox:GetPropertyChangedSignal("Text"):Connect(function()
	TextBox.Text = string.gsub(TextBox.Text, "\t", "    ")
end)

This is flawed.
Not only will this mess up the user’s CursorPosition every time they indent, but it means that if they want to traverse it via the arrow keys or to backspace it, it becomes 4 key presses instead of 1.

Currently, I use global substitution but manually move the CursorPosition based on changes I make. I still have to work out exactly to solve the 4:1 keypress issue. Or…

Roblox should handle tabs properly, and we shouldn’t be forced to sacrifice UX, CPU, and development time for such a basic feature.


Back in 2015, @TheNexusAvenger made this very short feature request that says the opposite. This implies that, once upon a time, Roblox actually did allow tabs. We should go back to that, rather than remove core functionality from a vague 2 sentence request. (No hate to Nexus tho <3)

16 Likes

I’m working on a simple IDE for my console language and I’m somewhat stuck because of this. Nexus’s feature request is more of a result of incompetence (sorry :c) as they could have easily fixed the spam issue by limiting how many lines and width a message can take up.

1 Like

I’m working on a less-than-simple IDE and this is a huge roadblock for me too.

This really needs to be fixed.