diff --git a/source/editor.cpp b/source/editor.cpp index 76cd58e..3844ea7 100644 --- a/source/editor.cpp +++ b/source/editor.cpp @@ -57,7 +57,6 @@ struct editorConfig int numrows; erow *row; int dirty; - char *filename; char statusmsg[80]; time_t statusmsg_time; bool running; @@ -397,31 +396,10 @@ void editorOpen(const char *data) void editorSave() { - if (E.filename == NULL) - { - E.filename = editorPrompt("Save as: %s (ESC to cancel)", NULL); - if (E.filename == NULL) - { - editorSetStatusMessage("Save aborted"); - return; - } - } - - int len; - char *buf = editorRowsToString(&len); - - std::ofstream file(E.filename, std::ios::binary | std::ios::out); - if (!file.is_open()) - { - free(buf); - editorSetStatusMessage("Can't save! I/O error"); - return; - } - file.write(buf, len); - file.close(); - - free(buf); - editorSetStatusMessage("Saved to disk"); + // int len; + // char *buf = editorRowsToString(&len); + // free(buf); + // editorSetStatusMessage("Saved"); E.dirty = 0; } @@ -632,7 +610,7 @@ void editorDrawStatusBar(struct abuf *ab) abAppend(ab, "\x1b[7m", 4); char status[80], rstatus[80]; int len = snprintf(status, sizeof(status), "%.20s - %d lines %s", - E.filename ? E.filename : "[No Name]", E.numrows, + "[No Name]", E.numrows, E.dirty ? "(modified)" : ""); int rlen = snprintf(rstatus, sizeof(rstatus), "%s | %d/%d", "no ft", E.cy + 1, E.numrows); @@ -907,7 +885,6 @@ void initEditor() E.numrows = 0; E.row = NULL; E.dirty = 0; - E.filename = NULL; E.statusmsg[0] = '\0'; E.statusmsg_time = 0; E.running = true;