add support for wrapping strings with newlines
This commit is contained in:
parent
6ef4044185
commit
70529b610f
5
util.py
5
util.py
|
@ -39,9 +39,12 @@ def RgSnippetWrapped(st, w, fForEditing = False, xStart = 0):
|
||||||
ichWrap = -1
|
ichWrap = -1
|
||||||
ichStart = 0
|
ichStart = 0
|
||||||
for ich, ch in enumerate(st):
|
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 == ' ':
|
if not fForEditing and ch == ' ':
|
||||||
ichWrap = ich
|
ichWrap = ich
|
||||||
if ich == ichStart + w - xStart:
|
if (ich == ichStart + w - xStart) or (ch == '\n'):
|
||||||
ichStartNew = ichWrap + 1
|
ichStartNew = ichWrap + 1
|
||||||
if ichWrap < 0:
|
if ichWrap < 0:
|
||||||
ichWrap = ich
|
ichWrap = ich
|
||||||
|
|
Loading…
Reference in a new issue