Problem with the function splitlines
Bug #1413273 reported by
Eugene
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
leo-editor |
Invalid
|
Wishlist
|
Edward K. Ream |
Bug Description
Hello,
I have a problem with string that's contains vertical tab, so function splitlines in the module leoGlobals treats this character as new line and thereby broke the string.
More information described in this issue: http://
As temporary solution I offer to rewrite the function splitlines:
def splitLines (s):
'''Split s into lines, preserving the number of lines and
the endings of all lines, including the last line.'''
# g.stat()
if s:
# return s.splitlines(True) # This is a Python string function!
lines = s.split(os.linesep)
return [x + os.linesep for x in lines]
else:
return []
To post a comment you must log in.
This LaunchPad page should not be used for new bug reports.
Please file all new bug reports at: https:/ /github. com/leo- editor/ leo-editor/ issues
> As temporary solution I offer to rewrite the function g.splitLines:
You are welcome to create your own code, but g.splitLines is not going to change, regardless of problems with str.splitlines.
In particular, making g.splitLines depend on os.linesep would be dangerous: it would infect the code with the so-called "cursed newline problem".
Edward