diff --git a/Buffer.cc b/Buffer.cc index c625e05..cb44e19 100644 --- a/Buffer.cc +++ b/Buffer.cc @@ -23,7 +23,6 @@ #include -#include #include #include #include @@ -68,7 +67,6 @@ Buffer::Buffer(std::filesystem::path fPath) this->cursor = Cursor(); this->file = OptFile(fPath.string()); if (this->Exists()) { - std::cout << "file exists, refreshing\n"; /// \todo Should I signal an error here, or is it /// okay for this to be a best-effort thing? this->status = this->Refresh(); @@ -144,14 +142,12 @@ Buffer::Refresh() /// We can't actually refresh a virtual buffer. Unlike flush, /// it doesn't make sense to Refresh from an alternate file. if (this->IsVirtual()) { - std::cerr << "[!] virtual file, bailing\n"; return Buffer::FileStatus::FileStatusVirtual; } auto realFile = this->file.value(); auto handle = realFile.Refresh(); if (!handle) { - std::cerr << "[!] file doesn't exist\n"; return FileStatus::FileStatusNonExistent; } @@ -164,7 +160,6 @@ Buffer::Refresh() /// contents first isn't the right move. Maybe mark the /// file as ReadOnly? if (!realHandle->good()) { - std::cerr << "[!] handle isn't good"; realHandle->close(); delete realHandle; return FileStatus::FileStatusIOFailed; @@ -306,10 +301,18 @@ Buffer::PrintBufferStatus(std::ostream &os) if (realFile.IsReadOnly()) { os << "@"; } else { - os << " "; + os << "-"; } - os << ":" << this->Size() << " + if (this->IsDirty()) { + os << "!"; + } else { + os << "-"; + } + + os << ":" << this->Size() << "B"; } - return os; + + os << "\n"; + return; } diff --git a/main.cc b/main.cc index 0a2aa32..1b9cadd 100644 --- a/main.cc +++ b/main.cc @@ -71,8 +71,7 @@ main(int argc, char *argv[]) } */ - std::cout << "\t[+] loaded buffer " << buffer.Name() - << " of " << buffer.Size() << " bytes.\n"; + buffer.PrintBufferStatus(std::cout); buffer.Close(); }