We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4306

Summary: Linux X11 message boxes 32 lines or longer display newlines as vertical tabs
Product: SDL Reporter: Daniel Bokser <dan.bokser>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: dan.bokser, icculus
Version: 2.0.9   
Hardware: x86_64   
OS: Linux   
Attachments: screenshot
sample program

Description Daniel Bokser 2018-10-12 12:06:32 UTC
Created attachment 3366 [details]
screenshot

I am running into a bug where i have a fairly large which is longer than 31 lines. After line 31, newlines are replaced with the vertical tab character (shown as VT). I have this issue only on X11. It looks fine on Mac and Windows. I have attached a screenshot and sample program.
Comment 1 Daniel Bokser 2018-10-12 12:07:30 UTC
Created attachment 3367 [details]
sample program
Comment 2 Daniel Bokser 2018-10-12 12:22:46 UTC
Apologies, I was assuming that the latest LTS ubuntu had 2.0.8, when in fact it has 2.0.4.  Putting this into waiting until I can test on 2.0.8 tonight
Comment 3 Daniel Bokser 2018-10-13 02:16:19 UTC
Confirmed this issue happens in 2.0.8 and the latest repo pull (2.0.9) on Ubuntu 16.04 LTS. Reopening...
Comment 4 Daniel Bokser 2018-10-14 18:40:34 UTC
Found the reason for this.  In SDL_x11messagebox.c it looks like the maximum number of lines is 32

>#define MAX_TEXT_LINES          32      /* Maximum number of text lines supported */


Increasing this value fixes my problem.  I could not find any documented reason for this limit. The SDL_ShowMessageBox page does not document this limitation either.  

What is the reason for this limit?
Comment 5 Ryan C. Gordon 2018-10-15 04:47:21 UTC
(In reply to Daniel Bokser from comment #4)
> What is the reason for this limit?

Probably an assumption that it would be more than anyone would need, since it specifies the size of a static array.

To be clear, 32 lines in a messagebox is probably more than one should put in a messagebox, but who am I to dictate absolute limits? This is fixed now, in https://hg.libsdl.org/SDL/rev/cf64a70ad02a

Thanks!

--ryan.
Comment 6 Daniel Bokser 2018-10-15 11:57:11 UTC
Thanks for the fix Ryan! Works perfect for me. 

Yea, agreed that 32 lines should be more than enough for a message box, but I am currently using it as a stop-gap to display controls for my emulator until I have a proper UI.