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:
parent
d6e28b02a3
commit
9156f5cf47
|
@ -63,7 +63,10 @@ impl Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_from_file(path: &Path) -> 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 {
|
let mut ed = Editor {
|
||||||
buffer: buf,
|
buffer: buf,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user