Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextEdit with line wrapping becomes unusable when repeatedly setting text via code. #102211

Closed
MewPurPur opened this issue Jan 30, 2025 · 2 comments · Fixed by #102296
Closed
Milestone

Comments

@MewPurPur
Copy link
Contributor

MewPurPur commented Jan 30, 2025

Tested versions

4.4 betas

System information

Godot v4.4.beta2 - Pop!_OS 22.04 LTS on X11 - X11 display driver, Multi-window, 1 monitor - OpenGL 3 (Compatibility) - Mesa Intel(R) Graphics (ADL GT2) - 12th Gen Intel(R) Core(TM) i5-1235U (12 threads)

Issue description

In 4.4 beta, it's very trivial to trigger an error in TextEdit where you consistently get the following error when setting the text: <anonymous lambda>(): Condition "total_visible_line_count < 0" is true. <C++ Source> scene/gui/text_edit.cpp:444 @ remove_range() <Stack Trace> Benchmark.gd:12 @ <anonymous lambda>()

It points here:

ERR_FAIL_COND(total_visible_line_count < 0); // BUG

It's not just an error spam, this also messes up the scrollbar and makes it impossible to scroll down in the text, so it pretty much completely ruins the node if you need to do this.

Sorry for the hideous crop:

2025-01-31.00-04-33.mp4

Steps to reproduce

const test_row = "zzz zzz zzz zzz zzz zzz zzz\n"

func _ready() -> void:
	var code_edit := TextEdit.new()
	code_edit.wrap_mode = TextEdit.LINE_WRAPPING_BOUNDARY
	add_child(code_edit)
	code_edit.size = Vector2(200, 125)
	
	var timer := Timer.new()
	timer.timeout.connect(func(): code_edit.text = test_row.repeat(5))
	add_child(timer)
	timer.start()

Minimal reproduction project (MRP)

Haven't made one, but I provided the code to replicate this.

@MewPurPur MewPurPur changed the title TextEdit with line wrapping gets an unusable TextEdit with line wrapping becomes unusable when setting text via code. Jan 30, 2025
@MewPurPur MewPurPur changed the title TextEdit with line wrapping becomes unusable when setting text via code. TextEdit with line wrapping becomes unusable when repeatedly setting text via code. Jan 30, 2025
@MewPurPur
Copy link
Contributor Author

This is a regression from 4.3 also.

@J-Hendrick
Copy link

I have experienced this same exact problem here too. Running 4.4 b1. Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants