-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Description
In windows, when run python -m vimdoc .
the txt file is generated, but the fileformate is changed to dos, is it possible to generate unix fireformate file?
https://stackoverflow.com/questions/6159900/correct-way-to-write-line-to-file
https://www.datacamp.com/community/tutorials/reading-writing-files-python
maybe this func need to be changed
def WriteLine(self, text='', right='', indent=0, leader=None, fill=' '):
"""Writes one line of output, breaking it up as needed."""
if leader is not None:
initial_indent = (indent * self.TAB) + leader
subsequent_indent = (indent + 1) * self.TAB
else:
initial_indent = indent * self.TAB
subsequent_indent = indent * self.TAB
wrapper = textwrap.TextWrapper(
width=self.WIDTH,
initial_indent=initial_indent,
subsequent_indent=subsequent_indent,
break_on_hyphens=False)
lines = wrapper.wrap(text)
# wrap returns empty list for ''. See http://bugs.python.org/issue15510.
lines = lines or ['']
lastlen = len(lines[-1])
rightlen = len(right)
assert rightlen <= self.WIDTH
if right and lastlen + rightlen + 1 > self.WIDTH:
lines.append('')
lastlen = 0
if right:
padding = self.WIDTH - lastlen - rightlen
assert padding >= 0
lines[-1] += (fill * padding) + right
for line in lines:
self.Print(line)
Metadata
Metadata
Assignees
Labels
No labels