From 7055ca08731ef833565c9a8ca63710495aaa95c4 Mon Sep 17 00:00:00 2001 From: moculus Date: Fri, 20 Jul 2007 00:22:45 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- application.py | 2 ++ buffer2.py | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/application.py b/application.py index a55fbb0..70ea103 100755 --- a/application.py +++ b/application.py @@ -806,6 +806,8 @@ if __name__ == "__main__": buffers = [] names = sets.Set() paths = sets.Set() + if not args: + args = ['.'] for path in args: path = os.path.abspath(os.path.realpath(util.expand_tilde(path))) if path in paths: diff --git a/buffer2.py b/buffer2.py index 6da01ea..4b9dcc8 100644 --- a/buffer2.py +++ b/buffer2.py @@ -417,7 +417,7 @@ class FileBuffer(Buffer): self.store_checksum(data) else: data = '' - for i in range(0, 8): + for i in range(0, min(len(data), 8)): if ord(data[i]) > 127: raise Exception, "editing binary files is not supported" data = self.read_filter(data) @@ -491,14 +491,15 @@ class DirBuffer(Buffer): def __init__(self, path, nl='\n', name=None): Buffer.__init__(self, nl) self.path = os.path.realpath(path) - if name is None: - self._name = os.path.basename(self.path) - else: - self._name = name + #if name is None: + # self._name = os.path.basename(self.path) + #else: + # self._name = name def readonly(self): return True def name(self): - return self._name + #return self._name + return self.path def path_exists(self): return os.path.exists(self.path)