Passing a filename that doesn't exist will now open a buffer that will be saved to a new file of that name.

This commit is contained in:
Nathan Vegdahl 2015-01-11 01:25:23 -08:00
parent d6e28b02a3
commit 9156f5cf47

View File

@ -63,7 +63,10 @@ impl Editor {
}
pub fn new_from_file(path: &Path) -> Editor {
let buf = load_file_to_buffer(path).unwrap();
let buf = match load_file_to_buffer(path) {
Ok(b) => {b},
_ => {Buffer::new()}
};
let mut ed = Editor {
buffer: buf,