Issue984

Title Console text stops refreshing after playing nethack for 15 minutes
Priority minor Status postponed
Assigned To Keywords
Linked issues Watchers

Submitted on 2023-01-03 01h18 by python, last changed by Wuzzy.

Messages
Author: python Date: 2023-01-03   01h18
V1.0-rc3

The console appears to stop refreshing text after playing nethack for a long 
period of time. Perhaps 15 minutes with of text is "too much" as might be 
triggering some sort of bug like a buffer overflow?
Author: fluzz Date: 2023-01-03   10h19
There is, theoretically, no limit on the text size by itself. But, the code used to display the scrolled text has potentially some limits (see below).

Anyhow, the principle is to render the whole text with a negative offset and then clip it to the window of the text widget. This is definitely not suited for a very huge text, and whole code should be changed...

So, there is a hard-coded limit in text.c:get_lines_needed():
"t_rect.h = 32767"
If the font height is 10 pixels, it means a limit of 3276 lines of text (if I'm not wrong).

Could you please do a small test: put that number to 1000, for instance, play the nethack minigame, and check that the text quickly stops to scroll ?
Author: python Date: 2023-01-06   02h30
I successfully reproduced it with a value of 100. 

It's a shame that SDL1.2 limits the size to 16 bits.

SDL2 appears to have made SDL_Rect support 32 bit values. Although, I am not 
sure that it would be worth the extra work.
Author: fluzz Date: 2023-01-06   08h30
Thanks for the test !

Well, the 16bits limit is not a problem. Actually, we should not render ALL the text, but start one line before the first visible one...

Given that such a change could have side effects, we postpone to after 1.0.
Author: Wuzzy Date: 2024-03-03   16h35
I recently made a full playthrough of version 1.0 and I bumped into the bug multiple times when trying to actually win Nethack. Thankfully, I discovered the workaround: Leave the console and join again (thankfully, Nethack saves progress).

Triggering this bug is common and very likely if you want to win (but fail a lot in the first tries lol); it took me about 1-2 hours for the first win so it is definitely realistic to trigger.

Now that 1.0 was released, I think this bug should no longer count as postponed?
History
Date User Action Args
2024-03-03 16:35:53Wuzzysetmessages: + msg3815
2023-07-30 15:50:44fluzzsetstatus: open -> postponed
2023-01-06 08:30:52fluzzsetmessages: + msg3808
2023-01-06 02:30:40pythonsetmessages: + msg3807
2023-01-03 10:19:41fluzzsetmessages: + msg3783
2023-01-03 01:30:15pythonsettitle: See attached screenshot, Console text stops refreshing after playing nethack for 15 minutes -> Console text stops refreshing after playing nethack for 15 minutes
2023-01-03 01:29:38pythonsettitle: Console text stops refreshing after playing nethack for 15 minutes -> See attached screenshot, Console text stops refreshing after playing nethack for 15 minutes
2023-01-03 01:20:09pythonsettitle: Console text stops refreshing after playing netback for 15 minutes -> Console text stops refreshing after playing nethack for 15 minutes
2023-01-03 01:18:53pythoncreate