From 70529b610f1ba20dad673f8c643cf24e2252ba14 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Wed, 5 Oct 2011 17:45:58 -0400 Subject: [PATCH] add support for wrapping strings with newlines --- util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util.py b/util.py index da6b88f..ea42691 100644 --- a/util.py +++ b/util.py @@ -39,9 +39,12 @@ def RgSnippetWrapped(st, w, fForEditing = False, xStart = 0): ichWrap = -1 ichStart = 0 for ich, ch in enumerate(st): + if ch == '\n': + assert not fForEditing, "no support yet for editing strings with newlines" + ichWrap = ich if not fForEditing and ch == ' ': ichWrap = ich - if ich == ichStart + w - xStart: + if (ich == ichStart + w - xStart) or (ch == '\n'): ichStartNew = ichWrap + 1 if ichWrap < 0: ichWrap = ich