Matěj Cepl wrote: > I have a gedit Python plugin which should do line wrap using > textwrap.fill() function. However, even when I have set the > length of line to the same number as in vim (65), the result is > substantially different (textwrap.fill paragraphs are > significantly narrower). See for example this diff (removed > lines are wrapped by vim, added by textwrap.fill-based plugin). > > Why cannot textwrap.fill get those words “grown so” to the first > line of the wrapped text? Any ideas about the difference in the > algorithms for line-wrapping in vim and in textwrapper.fill?
It's not the algorithm, it's the width. Try textwrap.fill(text, 72). -- https://mail.python.org/mailman/listinfo/python-list