Subtitle wordwrap can cause an infinite loop
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ren'Py |
Fix Released
|
Medium
|
Tom Rothamel |
Bug Description
Attempting to render excessively long text with layout='subtitle' and no spaces to break on will cause a tight infinite loop.
(Testcase:
$ x = 30
label wrapfail:
show expression Text('M'
"%(x)d"
$ x += 1
jump wrapfail
)
The actual loop is in renpy/display/
generate the optimum layout with the string of Ms - not sure if that's a problem in my change or a problem in the original subtitle layout, but it's better than an infinite loop.)
*** text.py.orig 2009-08-04 17:18:15.000000000 -0700
--- text.py 2009-08-04 18:27:50.000000000 -0700
***************
*** 548,553 ****
--- 548,564 ----
lines_last = [ ]
for triples in pars:
+ x = 0
+ newtriples = []
+ while x<len(triples):
+ triplewidth = layout_
+ if triplewidth<=width or triples[
+ newtriples.
+ else:
+ for char in triples[x][2]:
+ newtriples.
+ x+=1
+ triples = newtriples
sumwidths = layout_
(End patch)
Changed in renpy: | |
status: | Triaged → Fix Committed |
Changed in renpy: | |
status: | Fix Committed → Fix Released |
This seems as sensible a behavior as any. Could you post your patch as an attachment, as it seems to have been reformatted by launchpad.