godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 68 forks source link

Add vertical and horizontal alignment to TextEdit #7352

Open FoolLin opened 11 months ago

FoolLin commented 11 months ago

Describe the project you are working on

A 2d game that require players to answer the quiz.

Describe the problem or limitation you are having in your project

TextEdit will always align top left, making it feel out of place in some of my UI.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add TextEdit vertical and horizontal alignment to increase flexibility when designing UI.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Just like alignment parameter in Label node.

If this enhancement will not be used often, can it be worked around with a few lines of script?

There's some work around but non can covered all TextEdit functions.

  1. Use VBoxContainer to make TextEdit align verticle but not HBoxContainer to make it align horizontal, TextEdit will just collapse
  2. Use invisible TextEdit/LineEdit as an user input reader and use Label/RichTextLabel as an text displayer, this allow text to be align and format at the cost of inability to see or reposition caret.

Is there a reason why this should be core and not an add-on in the asset library?

It such a basic feature from user end perspective.

Calinou commented 11 months ago

TextEdit will always align top left, making it feel out of place in some of my UI.

Could you take a screenshot to show an example?

In my experience, editable text that is center-aligned feels like an UX antipattern, as both the left and right edges move constantly while you're typing. This can make selecting text take more time than needed.

FoolLin commented 11 months ago

Could you take a screenshot to show an example?

When the user is taking a quiz, both the question label and choice button text are centered (picture 1). However, when the user wants to edit the quiz, all text UI must be changed to TextEdit, causing it to align top left instead (picture 2). In my opinion, this makes the quiz editor not reflect what the UI would look like when shared with other users. I can't use LineEdit in this situation either, since the UI will be compressed on mobile platforms, so multiple lines are needed (picture 3).

ui_screenshot

CovenautaDev commented 5 months ago

I from the Reddit post, and yes this would be so good, because of cases like this were you want to allow people to edit something in multi-line format. In my case I have an Exel like grid and each cell has a CodeEdit to use its autocomplete feature, but I found visually ugly a left text and I was searching a way to center it, such thing that doesn't existe yet. Maybe in a document type program is better a normal left or right alignment, but in cases like this LineEdit is not enough and if you use a Label (that I was using before) it's had because you need to re-create an editing system, an autocomplete system, a line to show that you are writing on it, etc.

CovenautaDev commented 5 months ago

Also, I was trying a lot of things and seems like there is not another option than add spaces in the text or create a Label on top of that which will remplace the TextEdit once you have editing it, which is more work with Inputs and adding more nodes to the scene for a feature that feel like basic. (even centered the TextEdit node itself doesn't work because seems like it cannot extend to fit text Horizontally until reach to a limit, but the line below will be not centered anyways)

alanenggb commented 3 months ago

All in for this! I'm making an app in which the user can add text controls around, then type and format it, a lot like an HTML textarea. Unfortunately no text editing input in Godot can do this.