]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
Removed rope accessor from buf.ml and switched scrollmap completely over to cursor...
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 7 Nov 2017 15:41:01 +0000 (10:41 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 7 Nov 2017 15:41:01 +0000 (10:41 -0500)
docs/Buf.Cursor.html
docs/Buf.html
docs/index_values.html
docs/type_Buf.Cursor.html
lib/buf.ml
lib/buf.mli
lib/scrollmap.ml

index e9499e01cc572e36d0be0afbe8af5932d7822528..0ee7c573d5fece5e3873ee189d983fe8e764af12 100644 (file)
@@ -54,4 +54,6 @@
 <pre><span id="VALnextc"><span class="keyword">val</span> nextc</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int</code></pre>
 <pre><span id="VALprevc"><span class="keyword">val</span> prevc</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int</code></pre>
 <pre><span id="VALnextln"><span class="keyword">val</span> nextln</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int</code></pre>
-<pre><span id="VALprevln"><span class="keyword">val</span> prevln</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int</code></pre></body></html>
\ No newline at end of file
+<pre><span id="VALprevln"><span class="keyword">val</span> prevln</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int</code></pre>
+<pre><span id="VALis_eol"><span class="keyword">val</span> is_eol</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> bool</code></pre>
+<pre><span id="VALto_bol"><span class="keyword">val</span> to_bol</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int</code></pre></body></html>
\ No newline at end of file
index 9a579ca72164ac3e8f952b8b2b1d1d950fb2b8d1..15b942c55b046bd923e42c246af8d5df8f72e614 100644 (file)
@@ -53,7 +53,7 @@
 
 <pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a></code></pre>
 <pre><span id="VALload"><span class="keyword">val</span> load</span> : <code class="type">string -> <a href="Buf.html#TYPEbuf">buf</a></code></pre>
-<pre><span id="VALrope"><span class="keyword">val</span> rope</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> <a href="Rope.html#TYPEt">Rope.t</a></code></pre>
 <pre><span id="VALiter_from"><span class="keyword">val</span> iter_from</span> : <code class="type">(<a href="Rope.html#TYPErune">Rope.rune</a> -> bool) -> <a href="Buf.html#TYPEbuf">buf</a> -> int -> unit</code></pre>
 <pre><span id="VALiteri_from"><span class="keyword">val</span> iteri_from</span> : <code class="type">(int -> <a href="Rope.html#TYPErune">Rope.rune</a> -> bool) -> <a href="Buf.html#TYPEbuf">buf</a> -> int -> unit</code></pre>
+<pre><span id="VALis_eol"><span class="keyword">val</span> is_eol</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> bool</code></pre>
 <pre><span class="keyword">module</span> <a href="Buf.Cursor.html">Cursor</a>: <code class="code">sig</code> <a href="Buf.Cursor.html">..</a> <code class="code">end</code></pre></body></html>
\ No newline at end of file
index 481f44dd2a66862c10a0f50300172a691c49dc9a..8c16029f2a3dd544b29ce250a5ebaba489923112 100644 (file)
 <td></td></tr>
 <tr><td><a href="Rope.html#VALis_bol">is_bol</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.Cursor.html#VALis_eol">is_eol</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.html#VALis_eol">is_eol</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td><a href="Rope.html#VALis_eol">is_eol</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td><a href="Buf.html#VALiter_from">iter_from</a> [<a href="Buf.html">Buf</a>]</td>
 <td></td></tr>
 <tr><td><a href="Draw.Cursor.html#VALrestart">restart</a> [<a href="Draw.Cursor.html">Draw.Cursor</a>]</td>
 <td></td></tr>
-<tr><td><a href="Buf.html#VALrope">rope</a> [<a href="Buf.html">Buf</a>]</td>
-<td></td></tr>
 <tr><td><a href="Draw.html#VALrule_bkg">rule_bkg</a> [<a href="Draw.html">Draw</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.html#VALruler_column">ruler_column</a> [<a href="Cfg.html">Cfg</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.Color.html#VALtags_sel">tags_sel</a> [<a href="Cfg.Color.html">Cfg.Color</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.Cursor.html#VALto_bol">to_bol</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
+<td></td></tr>
 <tr><td><a href="Rope.html#VALto_bol">to_bol</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td><a href="Rope.html#VALto_eol">to_eol</a> [<a href="Rope.html">Rope</a>]</td>
index bf0d4676b62a974207873ca887c3afb6047c007f..fe5006651636ad89810b161b343a0babb4223044 100644 (file)
@@ -27,4 +27,6 @@
 &nbsp;&nbsp;<span class="keyword">val</span>&nbsp;prevc&nbsp;:&nbsp;<span class="constructor">Buf</span>.buf&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;int<br>
 &nbsp;&nbsp;<span class="keyword">val</span>&nbsp;nextln&nbsp;:&nbsp;<span class="constructor">Buf</span>.buf&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;int<br>
 &nbsp;&nbsp;<span class="keyword">val</span>&nbsp;prevln&nbsp;:&nbsp;<span class="constructor">Buf</span>.buf&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;int<br>
+&nbsp;&nbsp;<span class="keyword">val</span>&nbsp;is_eol&nbsp;:&nbsp;<span class="constructor">Buf</span>.buf&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;bool<br>
+&nbsp;&nbsp;<span class="keyword">val</span>&nbsp;to_bol&nbsp;:&nbsp;<span class="constructor">Buf</span>.buf&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;int<br>
 <span class="keyword">end</span></code></body></html>
\ No newline at end of file
index 2dd9911fc44dccbc7fe7c674966337cfa4374073..cdefefba89ebeb67838f40f795e4db9ee1182372 100644 (file)
@@ -11,15 +11,15 @@ let empty =
 let load path =
   { path = path; rope = Rope.from_string (Misc.load_file path) }
 
-let rope buf = (* DELETEME *)
-  buf.rope
-
 let iter_from fn buf i =
   Rope.iter_from fn buf.rope i
 
 let iteri_from fn buf i =
   Rope.iteri_from fn buf.rope i
 
+let is_eol buf off =
+  Rope.is_eol buf.rope off
+
 module Cursor = struct
   type csr = {
     mutable start : int;
@@ -51,5 +51,11 @@ module Cursor = struct
 
   let prevln buf csr =
     csr.stop <- (Rope.prevln buf.rope csr.stop); csr.stop
+
+  let is_eol buf csr =
+    Rope.is_eol buf.rope csr.stop
+
+  let to_bol buf csr =
+    csr.stop <- (Rope.to_bol buf.rope csr.stop); csr.stop
 end
 
index b565d38c77c36c5588f050d2ab092be7b4d3b57f..12b49c26637b2313a41839b4c780df632bd66e47 100644 (file)
@@ -2,13 +2,15 @@ type buf
 type t = buf
 val empty : t
 val load : string -> t
-val rope : t -> Rope.t
 val iter_from : (int -> bool) -> t -> int -> unit
 val iteri_from : (int -> int -> bool) -> t -> int -> unit
 
+val is_eol : buf -> int -> bool
+
 module Cursor : sig
   type t
   val make : buf -> int -> t
+  val offset : buf -> t -> int
   val goto : buf -> t -> int -> unit
   val getc : buf -> t -> int
   (*
@@ -20,4 +22,7 @@ module Cursor : sig
   val prevc : buf -> t -> int
   val nextln : buf -> t -> int
   val prevln : buf -> t -> int
+
+  val is_eol : buf -> t -> bool
+  val to_bol : buf -> t -> int
 end
index 52ec4ef6af9baa97711f2b5de0dabc461c3a8cd7..01914d66ef73b7704f822abedcaeb99796bc1ab8 100644 (file)
@@ -11,12 +11,12 @@ let rec find_line lines off idx =
     idx
 
 let make buf width off =
-  let csr = Draw.Cursor.make (width, 0) 0 0 in
-  let bol = (Rope.to_bol (Buf.rope buf) off) in
-  let lines = ref [bol] in
+  let bcsr = Buf.Cursor.make buf off in
+  let dcsr = Draw.Cursor.make (width, 0) 0 0 in
+  let lines = ref [Buf.Cursor.to_bol buf bcsr] in
   let process_glyph i c =
-    let not_eol = ((Rope.is_eol (Buf.rope buf) i) == false) in
-    if (Draw.Cursor.next_glyph csr c) && not_eol then
+    let not_eol = ((Buf.is_eol buf i) == false) in
+    if (Draw.Cursor.next_glyph dcsr c) && not_eol then
       lines := i :: !lines;
     not_eol
   in