Avoid empty stripped frames causing newlines in narrow width.
Avoid empty stripped frames causing newlines in narrow width.


Index: pyglet/layout/frame.py
===================================================================
--- pyglet/layout/frame.py	(revision 684)
+++ pyglet/layout/frame.py	(working copy)
@@ -521,6 +521,13 @@
                 child.flow_inline(context)

             while child:
+                # Avoid adding empty frames into line box
+                if strip_lines and lines[-1].is_empty:
+                    child.lstrip()
+                if not child.border_edge_width:
+                    child = child.continuation
+                    continue
+
                 self.flowed_children.append(child)
                 context.strip_next = child.strip_next
                 child_width = child.margin_left + child.border_edge_width + \
@@ -589,8 +596,6 @@
         self.line_descent = min(self.line_descent, frame.line_descent)
         self.line_height = max(self.line_height,
                                self.line_ascent - self.line_descent)
-        if self.strip_lines and self.is_empty:
-            frame.lstrip()
         self.is_empty = False

     def position(self, x, y, containing_block):

oktayacikalin/pyglet,theblacklion/pyglet,mammadori/pyglet,theblacklion/pyglet,oktayacikalin/pyglet,theblacklion/pyglet,mammadori/pyglet,mammadori/pyglet,mammadori/pyglet,theblacklion/pyglet,oktayacikalin/pyglet,oktayacikalin/pyglet,oktayacikalin/pyglet,theblacklion/pyglet