<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
<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
<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>
<span class="keyword">val</span> prevc : <span class="constructor">Buf</span>.buf <span class="keywordsign">-></span> <span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr <span class="keywordsign">-></span> int<br>
<span class="keyword">val</span> nextln : <span class="constructor">Buf</span>.buf <span class="keywordsign">-></span> <span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr <span class="keywordsign">-></span> int<br>
<span class="keyword">val</span> prevln : <span class="constructor">Buf</span>.buf <span class="keywordsign">-></span> <span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr <span class="keywordsign">-></span> int<br>
+ <span class="keyword">val</span> is_eol : <span class="constructor">Buf</span>.buf <span class="keywordsign">-></span> <span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr <span class="keywordsign">-></span> bool<br>
+ <span class="keyword">val</span> to_bol : <span class="constructor">Buf</span>.buf <span class="keywordsign">-></span> <span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr <span class="keywordsign">-></span> int<br>
<span class="keyword">end</span></code></body></html>
\ No newline at end of file
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;
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
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
(*
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
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