Godot-proposals: LineEdit and TextEdit enhancements

Created on 4 Oct 2019  路  5Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
This enhancement isn't really project specific, but I came across these things while working on a modelling tool for minecraft entities that consist of cuboids, which intensively uses the UI nodes.

Describe the problem or limitation you are having in your project:
There are no limitations caused by these issues, but these small things made the editor appear less "professional", as the UI seemed to be off and not very user friendly (especially because the LineEdit might only show a single character when removing text, which could get the user lost)

Describe how this feature / enhancement will help you overcome this problem or limitation:
These enhancements would make the nodes to be more appealing to the user. More details below.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
See the linked issues in the text below - they contain gifs that clearly show the issues I am having.

Describe implementation detail for your proposal (in code), if possible:

These are a few things regarding LineEdit or TextEdit that should be changed to match other applications behaviour and make them more appealing.

First of all; these two nodes are drifting apart in terms of what they should have in common.

  • clicking on a letter in LineEdit always places the caret right in front of the clicked letter. On TextEdit however if the first half of the letter was clicked, it places the caret in front of the letter and behind of the letter if the latter half was clicked.
  • the width of the caret differs between these two nodes (TextEdit has a wider caret). This can be a problem in forms that use both of these nodes. I personally prefer the width of the LineEdit caret.
  • double clicking on a LineEdit marks the whole text but keeps the caret position, TextEdit places the caret behind the marked text.
  • https://github.com/godotengine/godot/issues/12810
  • removing text from a LineEdit that contains more text than can be drawn will result in it no longer presenting as much information to the user as possible. TextEdit adjusts the scroll position. This can be seen in the gif of this issue; https://github.com/godotengine/godot/issues/27420

These are just the things I remember. I just tested them again while writing this issue in an up to date build of the master branch. More can be found when browsing through open issues.

Possible solution:
The issue https://github.com/godotengine/godot/issues/31739 suggests that TextEdit should be split into two classes that inherit what they have in common. We could apply the same to TextEdit and LineEdit - have them inherit their common behaviour which could prevent this from even happening. Just adjusting both of them would lead to new issues in the future.

Now let's move on to the improvements.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
While a few of these can be worked around with a few lines of script, they should not even require that. Most of them however can not be adjusted solely in GDScript.

Is there a reason why this should be core and not an add-on in the asset library?:
Yes, as this enhancement enhances the core nodes of Godot to meet behaviour that is common across other applications - for example the web browser you are currently using.

gui

Most helpful comment

The joining of TextEdit and LineEdit has been discussed a few times previously, to cut a long story short, they both serve entirely different use cases and are not that interchangeable. The effort required to join them and maintenance in the longer term heavily outweighs the benefits of keeping them separate.

The rest of these are bugs, that will get fixed eventualy!

All 5 comments

Yeah, prob just low priority issues atm (they all seems like bugs to me), but I'm sure they'll get fixed eventually. Btw, I commented on one of your issues. I could never explain that issue into words. I'm happy you created it, it's appreciated

the width of the caret differs between these two nodes (TextEdit has a wider caret). This can be a problem in forms that use both of these nodes. I personally prefer the width of the LineEdit caret.

I explained the rationale for this in https://github.com/godotengine/godot/pull/20498. I don't think there's a perfect way of doing it, as the thicker caret is preferred by many in code editors.

the width of the caret differs between these two nodes (TextEdit has a wider caret). This can be a problem in forms that use both of these nodes. I personally prefer the width of the LineEdit caret.

I explained the rationale for this in godotengine/godot#20498. I don't think there's a perfect way of doing it, as the thicker caret is preferred by many in code editors.

Well, in that case I'm positive that this will no longer be an issue when TextEdit and CodeEdit are seperated.

The joining of TextEdit and LineEdit has been discussed a few times previously, to cut a long story short, they both serve entirely different use cases and are not that interchangeable. The effort required to join them and maintenance in the longer term heavily outweighs the benefits of keeping them separate.

The rest of these are bugs, that will get fixed eventualy!

Thanks, feel free to close this if it doesn't belong here. I will then just open new issues on the main issue tracker if they aren't present already.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KoBeWi picture KoBeWi  路  3Comments

rainlizard picture rainlizard  路  3Comments

PLyczkowski picture PLyczkowski  路  3Comments

SleepProgger picture SleepProgger  路  3Comments

SpyrexDE picture SpyrexDE  路  3Comments