Create empty file if input doesn't exist

This commit is contained in:
Zachary Yedidia
2016-03-12 16:07:04 -05:00
parent 8072756990
commit 934634507d
4 changed files with 22 additions and 3 deletions

View File

@@ -50,18 +50,23 @@ class Buffer {
void remove(ulong start, ulong end) {
text.remove(start, end);
update();
}
void insert(ulong position, string value) {
text.insert(position, value);
update();
}
string substring(ulong start, ulong end = -1) {
if (end == -1) {
update();
return text.substring(start, text.length);
} else {
update();
return text.substring(start, end);
}
}
char charAt(ulong pos) {
update();
return text.charAt(pos);
}
}