Repository: kivy/kivy

Issue:
Label wrap are wrong sometimes
This wasn't an issue in 1.8 before, but it is now:

``` python
from kivy.base import runTouchApp
from kivy.uix.label import Label
runTouchApp(Label(
    text="This is a big line of text hell yeah.",
    text_size=(100, None)))
```

Result:
![image](https://cloud.githubusercontent.com/assets/37904/4371418/41d063f4-4317-11e4-945d-309d92adc644.png)



Discussion:
This happens because before, there was no stripping control. Now there are strip variables, one of which, is `strip`, which if true strips like you expect. The default is False, because that is closest to how it was before.

So it looks like there are three options I can see:
1. Leave it as it is, and note in the documentation that you need to set `strip: True` if you want wrapped text to behave.
2. Set the default to `True` - while this means the text will behave differently, it also means it will behave more naturally in that you wouldn't expect that space to be visible, and work more like it does in web programming (which a lot of people may have prior experience with).
3. Always strip the middle of wrapped lines. I'd provide an example, but the web browser strips the extra spaces automatically (a la option 2 :P).

I'd vote for 2, but in the past it was insisted that 1 is correct. I don't like 3 because I'd rather not make special exceptions.

Option 2 is my preference as well.

I feel like one of the areas of most pain for new users to kivy is working with our Label, it often only behaves as desired after enabling many disabled by default options. Another +1 for option 2 from me, it seems the only case where we would interrupt the user is in case of text like: 

```
'   Words after space' 
```

where user intends for the leading spaces, however this I think would be fairly rare, and quickly fixed with a look at the docs.

I wonder if strip should only care about the spaces really at begining/end of the text set by the user, not at the beginning/end of lines created by reflowing, seems like these ones should be managed by a different option, which would indeed be True by default (supressing them).


Resolving patch:
diff --git a/kivy/core/text/__init__.py b/kivy/core/text/__init__.py
--- a/kivy/core/text/__init__.py
+++ b/kivy/core/text/__init__.py
@@ -500,14 +500,22 @@ def render(self, real=False):
                                     options['halign'][-1] == 'y')
         uw, uh = options['text_size'] = self._text_size
         text = self.text
-        if strip:
-            text = text.strip()
+        if not strip:
+            # all text will be stripped by default. unicode NO-BREAK SPACE
+            # characters will be preserved, so we replace the leading and
+            # trailing spaces with \u00a0
+            text = text.decode('utf8') if isinstance(text, bytes) else text
+            lspace = len(text) - len(text.lstrip())
+            rspace = len(text) - len(text.rstrip())
+            text = (u'\u00a0' * lspace) + text.strip() + (u'\u00a0' * rspace)
         if uw is not None and options['shorten']:
             text = self.shorten(text)
         self._cached_lines = lines = []
         if not text:
             return 0, 0
 
+        ostrip = options['strip']
+        strip = options['strip'] = True
         if uh is not None and options['valign'][-1] == 'e':  # middle
             center = -1  # pos of newline
             if len(text) > 1:
@@ -533,6 +541,7 @@ def render(self, real=False):
         else:  # top or bottom
             w, h, clipped = layout_text(text, lines, (0, 0), (uw, uh), options,
                 self.get_cached_extents(), options['valign'][-1] == 'p', True)
+        options['strip'] = ostrip
         self._internal_size = w, h
         if uw:
             w = uw


Test patch: