]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
implemented Buf.load
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 7 Oct 2017 01:57:14 +0000 (21:57 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 7 Oct 2017 01:57:14 +0000 (21:57 -0400)
Makefile
lib/buf.ml

index 68289b893d81d245b49c0306b1a756ccc39c522b..6ed9a5ed71dae34182ede1c739e04d655d789939 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,12 +25,12 @@ endif
 #-------------------------------------------------------------------------------
 BINS = edit
 LIBOBJS = \
+    lib/misc.$(OBJEXT) \
     lib/tide.$(OBJEXT) \
     lib/x11.$(OBJEXT) \
     lib/cfg.$(OBJEXT) \
     lib/rope.$(OBJEXT) \
     lib/buf.$(OBJEXT) \
-    lib/misc.$(OBJEXT) \
     lib/x11_prims.o \
     lib/misc_prims.o \
     lib/utf8.o
index 421d31a4dbe5f7223423c471df55563f1da06ff3..bb811bed54d608c150bb9c5b2ce7392bab2abbd6 100644 (file)
@@ -29,7 +29,10 @@ let create =
   { info = info; current = state; lastsave = state; undo = []; redo = [] }
 
 let load path =
-  create
+  let file  = Rope.from_string (Misc.load_file path) in
+  let state = { nlines = 0; outpoint = 0; rope = file }
+  and info  = { path = ""; modtime = 0; charset = Utf8; crlf = Unix } in
+  { info = info; current = state; lastsave = state; undo = []; redo = [] }
 
 let saveas buf path =
   ()