| 230 | } |
| 231 | |
| 232 | void ZepEditor::SaveBuffer(ZepBuffer& buffer) { |
| 233 | // TODO: |
| 234 | // - What if the buffer has no associated file? Prompt for one. |
| 235 | // - We don't check for outside modification yet either, meaning this could overwrite |
| 236 | std::ostringstream strText; |
| 237 | |
| 238 | if (buffer.HasFileFlags(FileFlags::ReadOnly)) { |
| 239 | strText << "Failed to save, Read Only: " << buffer.GetDisplayName(); |
| 240 | } else if (buffer.HasFileFlags(FileFlags::Locked)) { |
| 241 | strText << "Failed to save, Locked: " << buffer.GetDisplayName(); |
| 242 | } else if (buffer.GetFilePath().empty()) { |
| 243 | strText << "Error: No file name"; |
| 244 | } else { |
| 245 | int64_t size; |
| 246 | if (!buffer.Save(size)) { |
| 247 | strText << "Failed to save: " << buffer.GetDisplayName() << " at: " << buffer.GetFilePath().string(); |
| 248 | } else { |
| 249 | strText << "Wrote " << buffer.GetFilePath().string() << ", " << size << " bytes"; |
| 250 | } |
| 251 | } |
| 252 | SetCommandText(strText.str()); |
| 253 | } |
| 254 | |
| 255 | std::vector<ZepWindow*> ZepEditor::FindBufferWindows(const ZepBuffer* pBuffer) const { |
| 256 | std::vector<ZepWindow*> bufferWindows; |
no test coverage detected