tallforasmurf / PPQT

A post-processing tool for PGDP written in Python, PyQt4, and Qt
GNU General Public License v3.0
4 stars 2 forks source link

Something wacko when <tb> in /P #64

Closed tallforasmurf closed 12 years ago

tallforasmurf commented 12 years ago

Reflowing a longish /P .. P/ within which was a caused bizarre operation of the edit pane afterward. Something really bad got inserted on the text cursor, and even after ctl-Z it was ugly. Moving the out of the poem, or breaking the poem /P..P/ /P..P/ either way, no problem.

tallforasmurf commented 12 years ago

The issue was not but any reflow when a paragraph had a line that was shorter in total than the firstIndentDiff (left margin minus first margin). This happened to arise first in poetry, it could happen in /R or /Q or /U as well.

Fixed by testing the length of any paragraph to see if it had a single token (of any length; this solves another problem of a single token longer than the line size) or if the sum of tokens and spaces fit in the first line. These cases are handled separately by just building the output line. Thus only paragraphs that need line-breaks feed into the more complex machinery of line breaking.