Home Download Buy Blog Forum Support

Wrap paragraph splits hyphenated words

Wrap paragraph splits hyphenated words

Postby eurico on Thu Jun 28, 2012 10:07 pm

If you wrap the following line:

This is long line to be wrapped with a hyphenated word to illustrate the word-hyphenation bug.

the following two lines will be produced:

This is long line to be wrapped with a hyphenated word to illustrate the word-
hyphenation bug.

If you delete something in the first line and wrap again, this results in a space after the hyphen. E.g.:

This is long line with a hyphenated word to illustrate the word- hyphenation
bug.

I think this behavior is unexpected and incorrect in most situations. Is there a way to fix this? Thanks.
eurico
 
Posts: 4
Joined: Thu Jun 21, 2012 5:09 am

Re: Wrap paragraph splits hyphenated words

Postby pyr0 on Thu Jul 05, 2012 2:17 pm

I found this problem annoying when editing latex files. Use the following patch to fix it. Patch is for Sublime Text 2 Build 2181 OSX, but the same change should work for other builds and architectures.

--- Sublime Text 2/Packages/Default/paragraph.py 2012-07-05 14:36:35.000000000 +0100
+++ paragraph.py 2012-07-05 14:42:58.000000000 +0100
@@ -184,6 +184,7 @@ class WrapLinesCommand(sublime_plugin.Te
for s in self.view.sel():
wrapper = textwrap.TextWrapper()
wrapper.expand_tabs = False
+ wrapper.break_on_hyphens = False
wrapper.width = width
prefix = self.extract_prefix(s)
if prefix:
pyr0
 
Posts: 1
Joined: Thu Jul 05, 2012 2:11 pm

Re: Wrap paragraph splits hyphenated words

Postby eurico on Tue Jul 24, 2012 5:36 pm

This works great! Thanks a lot.
eurico
 
Posts: 4
Joined: Thu Jun 21, 2012 5:09 am


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 27 guests