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

Printed messages don't get grouped #49030

Closed
KoBeWi opened this issue May 24, 2021 · 3 comments · Fixed by #49060
Closed

Printed messages don't get grouped #49030

KoBeWi opened this issue May 24, 2021 · 3 comments · Fixed by #49060

Comments

@KoBeWi
Copy link
Member

KoBeWi commented May 24, 2021

Godot version:

d9d920e

Issue description:

func _process(delta):
	print("test") # same with printerr(), but red

LrnXy8x6Xh

I also seen a case where messages were correct when using print_line() from C++, but then an error was printed and grouping broke.

CC @EricEzaM ;)

@KoBeWi KoBeWi added this to the 4.0 milestone May 24, 2021
@EricEzaM
Copy link
Contributor

EricEzaM commented May 24, 2021

Duuuuude what is going on with this stuff.

It is 100% to do with the fact that when grouping messages the steps are 1) remove the last line on the RichTextLabel; and 2) add the text back with the count incremented. The first step is where the issue lies... RTLs don't like that step...

Should I just redraw the entire log every time...

@EricEzaM
Copy link
Contributor

EricEzaM commented May 24, 2021

I blame it on RichTextLabel... from my testing it seems pretty broken and the internals are very convoluted so I have no idea how to fix.

Put this script on a RichTextLabel node in a new scene...

extends RichTextLabel

func _ready():
	text = "test1\ntest2\ntest3\ntest4\ntest5\ntest6"

func _input(event):
	if event is InputEventKey:
		if event.keycode == KEY_SPACE and not event.echo and event.pressed:
			print("---------")
			print("before count: " + str(get_line_count()))
			remove_line(get_line_count() - 1)
			print("after count: " + str(get_line_count()))

Press space a bunch of times. Expectation: one line is removed at a time until none are left. Reality: No lines are removed until you press it 5 times, at which point the last 3 lines are removed at once. However, in the console, note that internally it thinks it has removed lines, but then after the 5th press it goes to reporting the number of lines before and after the remove_line is 3...

Perhaps I was doomed from the start if RichTextLabel is not working properly.

@EricEzaM
Copy link
Contributor

For now maybe "collapsing" should be removed. It seems to be having a lot of troubles.

EricEzaM added a commit to EricEzaM/godot that referenced this issue May 26, 2021
…orLog.

There were some issues in RichTextLabel `remove_line()` method, where items were not correctly removed, and line decremending for items in later lines was not correctly done.
This also fixed several headaches with EditorLog, which relied on the `remove_line()` method for collapsing of duplicate messages. The fix to RTL also fixed the issues with EditorLog.

Fixes godotengine#49030
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.

2 participants