On 2017-05-10, 22:28 GMT, Vláďa Macek wrote: > print textwrap.fill(instr, width=65).replace(u'~', > unichr(160))
No, udělal jsem v podstatě to: diff --git a/reflow.py b/reflow.py index 22b08cf..757077c 100644 --- a/reflow.py +++ b/reflow.py @@ -133,12 +133,18 @@ class ReflowPluginWindowActivatable(GObject.Object, Gedit.WindowActivatable): if isinstance(text, str): text = unicode(text, 'utf8') + # we don't want to break on the non-breaking space + # FIXME not sure whether there isn’t better replacement character + text = text.replace(unichr(0xA0), '~') + text = textwrap.fill(text, width=self.get_gedit_margin(), initial_indent=first_prefix, subsequent_indent=prefix, break_on_hyphens=False, drop_whitespace=True) + text = text.replace('~', unichr(0xA0)) + return text def _get_line(self, index): Ale nejsem na to hrdej. Navíc přemýšlím, jestli někdy nebudu chtít mít ~ znak v textu. Ale snad ne. Hezký den, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mc...@ceplovi.cz GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 Of course I'm respectable. I'm old. Politicians, ugly buildings, and whores all get respectable if they last long enough. --John Huston in "Chinatown." _______________________________________________ Python mailing list python@py.cz http://www.py.cz/mailman/listinfo/python Visit: http://www.py.cz