godotengine / godotengine/godot

TextEdit Node Bug - setting node.text = node.text in a signal call node.connect('text_changed', my_func) reverses printout of node.text

Open
#87,601 2 comments 0 reactions 0 assignees View on GitHub
documentation topic:gui
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.2.1.stable

### System information

Godot v4.2.1.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 6GB Laptop GPU () - 12th Gen Intel(R) Core(TM) i7-12650H (16 Threads)

### Issue description

For a textedit node I am trying to strip newline characters and limit the length to 15 characters (maybe i'll do a feature request for this). While trying to achieve this I noticed that the text always prints backwards. In the MRP I would expect if you set a variable to itself it would not change, however when you run the project you will observe that the text is reversed.

### Steps to reproduce

Create a new project using v4.2.1.stable. Add the script in MRP. Run the project and type 'hello' into the textedit. it will read at 'olleh'

### Minimal reproduction project (MRP)

extends Node2D

var textbox : TextEdit = TextEdit.new()

func _ready():

textbox.size = Vector2(200, 50)
add_child(textbox)
textbox.connect('text_changed', clip_text)

func clip_text() -> void:
textbox.text = textbox.text

Contributor guide

Open the contributing guide

Research direction

Run the provided minimal reproduction project with Godot 4.2.1 and confirm that assigning textbox.text to itself from the text_changed callback reverses the entered text. Start by tracing the TextEdit text_changed signal and text assignment behavior; done means the same assignment no longer reverses the displayed or printed text while text editing still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.