parent
832448bbea
commit
0108de71ab
|
@ -535,6 +535,7 @@ class FileBuffer(Buffer):
|
|||
Buffer.__init__(self)
|
||||
self.path = os.path.realpath(path)
|
||||
self.checksum = None
|
||||
self.bytemark = ''
|
||||
if name is None:
|
||||
self._name = os.path.basename(self.path)
|
||||
else:
|
||||
|
@ -588,10 +589,16 @@ class FileBuffer(Buffer):
|
|||
data = f.read()
|
||||
if '\t' in data:
|
||||
self.writetabs = True
|
||||
|
||||
f.close()
|
||||
self.store_checksum(data)
|
||||
else:
|
||||
data = ''
|
||||
|
||||
if data.startswith('\xEF\xBB\xBF'):
|
||||
self.bytemark = data[:2]
|
||||
data = data[2:]
|
||||
|
||||
self.nl = self._detect_nl_type(data)
|
||||
data = self.read_filter(data)
|
||||
data = data.replace("\t", " ")
|
||||
|
@ -633,7 +640,7 @@ class FileBuffer(Buffer):
|
|||
data = self.write_filter(data)
|
||||
|
||||
f2 = self._open_file_w(temp_path)
|
||||
f2.write(data)
|
||||
f2.write(self.bytemark + data)
|
||||
f2.close()
|
||||
|
||||
if self.path_exists():
|
||||
|
|
Loading…
Reference in New Issue