X Tutup
Skip to content

Fix LineEdit Unicode code-point/control character insertion failing to emit text_changed#111190

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
SantiagoDaza3:Open-Source-Contribution
Oct 20, 2025
Merged

Fix LineEdit Unicode code-point/control character insertion failing to emit text_changed#111190
Repiteo merged 1 commit intogodotengine:masterfrom
SantiagoDaza3:Open-Source-Contribution

Conversation

@SantiagoDaza3
Copy link
Contributor

@SantiagoDaza3 SantiagoDaza3 commented Oct 3, 2025

Summary

LineEdit did not emit text_changed when text was inserted via Unicode code-point input and the “Insert Control Character” menu. This would break UI logic that depends on text_changed.

Reproduction

Minimal scene with a single LineEdit element and the following attached script:

extends LineEdit
func _ready():
    text_changed.connect(func(new_text):
        print("text_changed:", new_text))

Pressing ctrl + shift + u and typing 2020 then pressing enter inserts the dagger character (†) but does not trigger text_changed i.e. no print statement is written to the console.

Right click + Insert Control Character (pick any) also inserts but does not trigger text_changed.

Godot.Pre-Fix.mp4

Fix

After performing the two aforementioned insertions, defer _text_changed() and set the text_changed_dirty guard (exact same process used in paste_text() ). Regular typing and paste behavior remains unaffected. set_text() is unchanged and still does not emit, as per the documentation. This is a small, localized fix in scene/gui/line_edit.cpp

Godot.Post-Fix.mp4

Testing

Verified fix on a Windows dev build, code-point submission and control character insertion now print once to the console and update any bound UI elements. Regular typing, paste, and deletions have been verified to still emit exactly once.

Formatting: clang-format 17

Fixes #110809

Note: There is an overlapping PR #110988 that instead moves the text_changed emission logic to the core function insert_text_at_caret() while removing text.length() != prev_len checks to determine whether to emit text_changed or not. Let me know if this more general change to a core function is preferred, as the changes in my PR attempt to fix two specific bugs without altering core functions while aligning with the existing architecture. A previous PR #84382 also attempted to alter insert_text_at_caret() directly which resulted in duplicate signals.

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only affecting user input, so should be safe.

@SantiagoDaza3
Copy link
Contributor Author

Thanks for the code reviews, I've applied all the suggested changes and CI is showing up green. Let me know if any more modifications are needed.

@Repiteo
Copy link
Contributor

Repiteo commented Oct 13, 2025

Could you squash your commits? See our pull request guidelines for more information

@SantiagoDaza3 SantiagoDaza3 force-pushed the Open-Source-Contribution branch from dc28761 to 82849b8 Compare October 15, 2025 22:37
@SantiagoDaza3
Copy link
Contributor Author

Could you squash your commits? See our pull request guidelines for more information

Done! The extra code review commits have been squashed.

@Repiteo
Copy link
Contributor

Repiteo commented Oct 17, 2025

Perfect! Now there's just one last thing: you'll need to remove the trailing Fixes Issue #110809 message from the commit, as it otherwise produces unwanted pings whenever that commit is mentioned

@SantiagoDaza3 SantiagoDaza3 force-pushed the Open-Source-Contribution branch from 82849b8 to 01b9208 Compare October 19, 2025 05:03
@SantiagoDaza3
Copy link
Contributor Author

Perfect! Now there's just one last thing: you'll need to remove the trailing Fixes Issue #110809 message from the commit, as it otherwise produces unwanted pings whenever that commit is mentioned

All done!

@Repiteo Repiteo merged commit d7943ae into godotengine:master Oct 20, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 20, 2025

Thanks! Congratulations on your first merged contribution! 🎉

@akien-mga akien-mga changed the title Fix 'LineEdit' Unicode code-point/control character insertion failing to emit text_changed Fix 'LineEdit' Unicode code-point/control character insertion failing to emit text_changed Jan 25, 2026
@akien-mga akien-mga changed the title Fix 'LineEdit' Unicode code-point/control character insertion failing to emit text_changed Fix LineEdit Unicode code-point/control character insertion failing to emit text_changed Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

text_changed not emitted for code point input and Insert Control Character options

4 participants

X Tutup