Skip to content

Commit fa8834b

Browse files
committed
Remove extraneous write, which doesn't define newline
1 parent e36aae0 commit fa8834b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

preditor/gui/workboxwidget.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ def __set_text__(self, txt):
207207

208208
@classmethod
209209
def __write_file__(cls, filename, txt, encoding=None):
210-
# Save unix newlines for simplicity
210+
# Save unix newlines for simplicity. This should only be called for
211+
# files which are not linked, so we don't inadvertently change a file's
212+
# line-endings. For linked files, call saveAs, which bypasses this
213+
# method writes without converting to unix line endings.
211214
txt = cls.__unix_end_lines__(txt)
212215
super(WorkboxWidget, cls).__write_file__(filename, txt, encoding=encoding)
213216

preditor/scintilla/documenteditor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,8 +1176,6 @@ def saveAs(self, filename='', setFilename=True):
11761176
try:
11771177
txt = self.text()
11781178
WorkboxMixin.__write_file__(filename, txt, encoding=self._encoding)
1179-
with open(filename, "w", encoding=self._encoding) as f:
1180-
f.write(self.text())
11811179
except PermissionError as error:
11821180
logger.debug('An error occurred while saving')
11831181
QMessageBox.question(

0 commit comments

Comments
 (0)