Here is the XHTML I used to test the issue:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<title>ADE Line Break Test</title>
<p>This is a paragraph with normal spaces.</p>
<p>This is a paragraph with non-breaking spaces.</p>
<p>This<span> </span>is<span> </span>a<span> </span>paragraph<span> </span>with<span> </sp an>non-breaking<span> </span>spaces<span> </span>in<span> </span>spans.</p>
Uh, all the spaces in the second and third paragraphs should be non-breaking, but the forum seems to be converting ampersand nbsp; into a non-breaking space, and not converting &, which would let me work around it.
I tried your code. It seems not so bad except an XHTML syntax issue on third paragraph. I don't use any CSS or stylesheet definition here as your code written. I got the following looking. If I correct your XHTML mark from </ span> to </span>, I can get the completly third paragraph.
So, what's your stylesheet definition? You may find a statement inside your XHTML file like:
<link href="template.css" rel="stylesheet" type="text/css"/>
And a .css file from your source folders ("template.css" in this case). Could you also provide this file? I've sent you a PM including my email address. You can send this file or the complete .EPUB book file to me for the analysis.
I didn't use a stylesheet; I just switched the font size to ultra large and made the window as small as possible to see the line-break behavior.
The second and third paragraphs should break the same way; instead, the second adds a hyphen after break in non-breaking, but the third breaks at the start of a span, leaving a non-breaking space to start the next line. (The second paragraph also isn't showing the second line, after the break, but that's a separate bug...)
I think I've managed to replicate it:
I have a testing epub available at https://www.box.net/shared/abfdd16afc15ca507ab8 so Peter can verify I got the gist of what he was noticing and so Derek can verify the behavior. I have not tested yet to see if the mobile devices I have which use ADE also exhibit this behavior, but I can tell you that ADE is the only desktop reader I'm seeing this in.
An interesting thing to note is that ADE seems to not be collapsing the leading whitespace after wrapping the line with nonbreaking spaces and spans.
Yeah, that test does show exactly the behavior I was noting. And the behavior of the paragraphs with non-wrapping white space is interesting, so that's neat.
I did actually get a sample to Derek over email, and he confirmed he could reproduce the issue.
I actually came back here to note that the issue remains in the just-released 1.8 preview 4.