finish debug dump
This commit is contained in:
parent
7cec414e3d
commit
5a9c09b217
19
Buffer.cc
19
Buffer.cc
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <random>
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue