]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/buffer/buffer.go
Fix serialization
[micro.git] / cmd / micro / buffer / buffer.go
index 8f256c2f40160c04db65f409a98737ff81f43f67..f68c5b58c07fb037d85d0e3cba15a6caf4e4a65b 100644 (file)
@@ -96,14 +96,6 @@ type Buffer struct {
        Type BufType
 }
 
-// The SerializedBuffer holds the types that get serialized when a buffer is saved
-// These are used for the savecursor and saveundo options
-type SerializedBuffer struct {
-       EventHandler *EventHandler
-       Cursor       Loc
-       ModTime      time.Time
-}
-
 // NewBufferFromFile opens a new buffer using the given path
 // It will also automatically handle `~`, and line/column with filename:l:c
 // It will return an empty buffer if the path does not exist
@@ -320,6 +312,20 @@ func calcHash(b *Buffer, out *[md5.Size]byte) {
        h.Sum((*out)[:0])
 }
 
+func (b *Buffer) insert(pos Loc, value []byte) {
+       b.isModified = true
+       b.LineArray.insert(pos, value)
+}
+func (b *Buffer) remove(start, end Loc) []byte {
+       b.isModified = true
+       sub := b.LineArray.remove(start, end)
+       return sub
+}
+func (b *Buffer) deleteToEnd(start Loc) {
+       b.isModified = true
+       b.LineArray.deleteToEnd(start)
+}
+
 // UpdateRules updates the syntax rules and filetype for this buffer
 // This is called when the colorscheme changes
 func (b *Buffer) UpdateRules() {