]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
stripped buf down to bare minimum
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 20 Oct 2017 01:39:17 +0000 (21:39 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 20 Oct 2017 01:39:17 +0000 (21:39 -0400)
edit.ml
lib/buf.ml

diff --git a/edit.ml b/edit.ml
index a8e7f56259dffc8e829bbbdf93385b69b993ab1e..c477612b17704fba6ed732f6b9260310fb72069a 100644 (file)
--- a/edit.ml
+++ b/edit.ml
@@ -4,7 +4,7 @@ open X11
 let font = font_load "Times New Roman:size=12"
 let font = font_load "Monaco:size=10::antialias=true:autohint=true"
 *)
-let font = font_load "Sans Serif:size=11:antialias=true:autohint=true"
+let font = font_load "Verdana:size=11:antialias=true:autohint=true"
 let tags_buf = ref Buf.create
 let edit_buf = ref Buf.create
 
index a67d558a51baa7d8c525a541f26e8dea7a611f22..80e33fdc8b878b78dd732dbbf228b3d500ab4a9b 100644 (file)
@@ -1,92 +1,19 @@
-type encoding = Utf8 | Binary
-
-type lfstyle = Unix | Dos
-
-type bufinfo = {
-  path: string;
-  modtime: int;
-  charset: encoding;
-  crlf: lfstyle;
-}
-
-type bufstate = {
-  nlines : int;
-  outpoint : int;
-  rope : Rope.t
-}
-
 type buf = {
-  info : bufinfo;
-  current : bufstate;
-  lastsave : bufstate;
-  undo : bufstate list;
-  redo : bufstate list;
+  path : string;
+  rope : Rope.t
 }
 
 let iter_from fn buf i =
-  Rope.iter_from fn buf.current.rope i
+  Rope.iter_from fn buf.rope i
 
 let create =
-  let state = { nlines = 0; outpoint = 0; rope = Rope.empty }
-  and info  = { path = ""; modtime = 0; charset = Utf8; crlf = Unix } in
-  { info = info; current = state; lastsave = state; undo = []; redo = [] }
+  { path = ""; rope = Rope.empty }
 
 let load path =
-  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 = [] }
+  { path = path; rope = Rope.from_string (Misc.load_file path) }
 
 let saveas buf path =
   ()
 
 let save buf =
-  saveas buf buf.info.path
-
-(*
-
-/* cursor/selection representation */
-typedef struct {
-    size_t beg;
-    size_t end;
-    size_t col;
-} Sel;
-
-void buf_init(Buf* buf, void ( *errfn )( char* ));
-size_t buf_load(Buf* buf, char* path);
-void buf_reload(Buf* buf);
-void buf_save(Buf* buf);
-
-size_t buf_insert(Buf* buf, bool indent, size_t off, Rune rune);
-size_t buf_delete(Buf* buf, size_t beg, size_t end);
-
-void buf_undo(Buf* buf, Sel* sel);
-void buf_redo(Buf* buf, Sel* sel);
-
-Rune buf_get(Buf* buf, size_t pos);
-size_t buf_end(Buf* buf);
-
-size_t buf_change(Buf* buf, size_t beg, size_t end);
-void buf_chomp(Buf* buf);
-void buf_loglock(Buf* buf);
-void buf_logclear(Buf* buf);
-bool buf_iseol(Buf* buf, size_t pos);
-size_t buf_bol(Buf* buf, size_t pos);
-size_t buf_eol(Buf* buf, size_t pos);
-size_t buf_bow(Buf* buf, size_t pos);
-size_t buf_eow(Buf* buf, size_t pos);
-size_t buf_lscan(Buf* buf, size_t pos, Rune r);
-size_t buf_rscan(Buf* buf, size_t pos, Rune r);
-void buf_getword(Buf* buf, bool ( *isword )(Rune), Sel* sel);
-void buf_getblock(Buf* buf, Rune beg, Rune end, Sel* sel);
-size_t buf_byrune(Buf* buf, size_t pos, int count);
-size_t buf_byword(Buf* buf, size_t pos, int count);
-size_t buf_byline(Buf* buf, size_t pos, int count);
-void buf_findstr(Buf* buf, int dir, char* str, size_t* beg, size_t* end);
-void buf_lastins(Buf* buf, size_t* beg, size_t* end);
-size_t buf_setln(Buf* buf, size_t line);
-size_t buf_getln(Buf* buf, size_t off);
-size_t buf_getcol(Buf* buf, size_t pos);
-size_t buf_setcol(Buf* buf, size_t pos, size_t col);
-
-*)
+  saveas buf buf.path