R. David Murray <rdmur...@bitdance.com> added the comment:

Ah, yes, the problem is more subtle than I thought.

The design here is that we should be starting with the largest lexical unit, 
seeing if that fits on the current line, or a line by itself, and if so, using 
that, and if not, move down to the next smaller lexical unit and try again, 
until we are finally left with an unbreakable unit.  For unstructured headers 
such as Subject the lexical units should be encoded words followed by blank 
delimited words.  I'm guessing the code is treating the collection of words it 
has accumulated as a unit in the above algorithm, and since it fits on a line 
by itself, it goes with that.  So yeah, it's sort of intentional.

So the bug here is that in your step 2 we ideally want to be considering 
whether the last token on the current line is at the same lexical level as the 
token that precedes it...and if so, and if moving that token to the next line 
lets the remainder fit on the first line, we should do that.  Exactly how to 
implement that correctly is a good question...it's been too long since I wrote 
that code, and I may not have time to investigate it more deeply.

If you come up with something based on my description of the intent above, I 
should be able to review it (though you might need to ping me directly to get 
my attention).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43493>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to