]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
Implemented various cursor and offset movement and test functions as curried wrappers...
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 8 Nov 2017 16:27:48 +0000 (11:27 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 8 Nov 2017 16:27:48 +0000 (11:27 -0500)
docs/Buf.Cursor.html
docs/Buf.html
docs/Scrollmap.html
docs/index_types.html
docs/index_values.html
docs/type_Buf.Cursor.html
lib/buf.ml
lib/buf.mli
lib/scrollmap.ml

index c9d7c7ea19dd4dd4b705db66e7f52fe7f2d580b8..42b69e93b154666d5480098d33391dad1662236f 100644 (file)
 <pre><span id="VALgoto"><span class="keyword">val</span> goto</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int -> unit</code></pre>
 <pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">(<a href="Buf.Cursor.html#TYPEcsr">csr</a> -> <a href="Rope.html#TYPErune">Rope.rune</a> -> bool) -> <a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> unit</code></pre>
 <pre><span id="VALgetc"><span class="keyword">val</span> getc</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> <a href="Rope.html#TYPErune">Rope.rune</a></code></pre>
+<pre><span id="VALmove_to"><span class="keyword">val</span> move_to</span> : <code class="type"><a href="Buf.html#TYPEdest">Buf.dest</a> -> <a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> int</code></pre>
 <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>
-<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="VALbol"><span class="keyword">val</span> bol</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="VALeol"><span class="keyword">val</span> eol</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_at"><span class="keyword">val</span> is_at</span> : <code class="type"><a href="Buf.html#TYPEdest">Buf.dest</a> -> <a href="Buf.html#TYPEbuf">Buf.buf</a> -> <a href="Buf.Cursor.html#TYPEcsr">csr</a> -> bool</code></pre>
+<pre><span id="VALis_bol"><span class="keyword">val</span> is_bol</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="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></body></html>
\ No newline at end of file
index d47d55586f4fc22b3b5d22becb93876019b3f8b2..e7943e79d63836d161e9d2c7f0d1b0788c40b1a7 100644 (file)
 <pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> = <code class="type"><a href="Buf.html#TYPEbuf">buf</a></code> </pre>
 
 
+<pre><code><span id="TYPEdest"><span class="keyword">type</span> <code class="type"></code>dest</span> = </code></pre><table class="typetable">
+<tr>
+<td align="left" valign="top" >
+<code><span class="keyword">|</span></code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTdest.StartOfLine"><span class="constructor">StartOfLine</span></span></code></td>
+
+</tr>
+<tr>
+<td align="left" valign="top" >
+<code><span class="keyword">|</span></code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTdest.EndOfLine"><span class="constructor">EndOfLine</span></span></code></td>
+
+</tr>
+<tr>
+<td align="left" valign="top" >
+<code><span class="keyword">|</span></code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTdest.NextChar"><span class="constructor">NextChar</span></span></code></td>
+
+</tr>
+<tr>
+<td align="left" valign="top" >
+<code><span class="keyword">|</span></code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTdest.PrevChar"><span class="constructor">PrevChar</span></span></code></td>
+
+</tr>
+<tr>
+<td align="left" valign="top" >
+<code><span class="keyword">|</span></code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTdest.NextLine"><span class="constructor">NextLine</span></span></code></td>
+
+</tr>
+<tr>
+<td align="left" valign="top" >
+<code><span class="keyword">|</span></code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTdest.PrevLine"><span class="constructor">PrevLine</span></span></code></td>
+
+</tr></table>
+
+
+
 <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="VALiteri"><span class="keyword">val</span> iteri</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="VALiter"><span class="keyword">val</span> iter</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 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
+<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>
+<pre><span id="VALmove_to"><span class="keyword">val</span> move_to</span> : <code class="type"><a href="Buf.html#TYPEdest">dest</a> -> <a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALnextc"><span class="keyword">val</span> nextc</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALprevc"><span class="keyword">val</span> prevc</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALnextln"><span class="keyword">val</span> nextln</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALprevln"><span class="keyword">val</span> prevln</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALbol"><span class="keyword">val</span> bol</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALeol"><span class="keyword">val</span> eol</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALeol"><span class="keyword">val</span> eol</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> int</code></pre>
+<pre><span id="VALis_at"><span class="keyword">val</span> is_at</span> : <code class="type"><a href="Buf.html#TYPEdest">dest</a> -> <a href="Buf.html#TYPEbuf">buf</a> -> int -> bool</code></pre>
+<pre><span id="VALis_bol"><span class="keyword">val</span> is_bol</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int -> bool</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></body></html>
\ No newline at end of file
index ce83037c13949aaabfb398dddaac09131357abdb..35cb91cba9d5d00d37799c52ac1cd20785c0bf4e 100644 (file)
@@ -56,8 +56,6 @@
 <pre><span id="VALfind_line"><span class="keyword">val</span> find_line</span> : <code class="type">'a array -> 'a -> int -> int</code></pre>
 <pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type"><a href="Buf.html#TYPEt">Buf.t</a> -> int -> int -> <a href="Scrollmap.html#TYPEt">t</a></code></pre>
 <pre><span id="VALfirst"><span class="keyword">val</span> first</span> : <code class="type"><a href="Scrollmap.html#TYPEt">t</a> -> int</code></pre>
-<pre><span id="VALbopl"><span class="keyword">val</span> bopl</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> int -> int</code></pre>
-<pre><span id="VALbonl"><span class="keyword">val</span> bonl</span> : <code class="type"><a href="Buf.html#TYPEbuf">Buf.buf</a> -> int -> int</code></pre>
 <pre><span id="VALscroll_up"><span class="keyword">val</span> scroll_up</span> : <code class="type"><a href="Scrollmap.html#TYPEt">t</a> -> <a href="Buf.html#TYPEt">Buf.t</a> -> <a href="Scrollmap.html#TYPEt">t</a></code></pre>
 <pre><span id="VALscroll_dn"><span class="keyword">val</span> scroll_dn</span> : <code class="type"><a href="Scrollmap.html#TYPEt">t</a> -> <a href="Buf.html#TYPEt">Buf.t</a> -> <a href="Scrollmap.html#TYPEt">t</a></code></pre>
 <pre><span id="VALresize"><span class="keyword">val</span> resize</span> : <code class="type"><a href="Scrollmap.html#TYPEt">t</a> -> <a href="Buf.html#TYPEt">Buf.t</a> -> int -> <a href="Scrollmap.html#TYPEt">t</a></code></pre></body></html>
\ No newline at end of file
index f14859495c05d3e26a8adbd68cd82bb8f451b625..79c783a9ad95fc8fba109bb3669e20197ab5d9d8 100644 (file)
@@ -27,6 +27,9 @@
 <tr><td align="left"><br>C</td></tr>
 <tr><td><a href="Buf.Cursor.html#TYPEcsr">csr</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
 <td></td></tr>
+<tr><td align="left"><br>D</td></tr>
+<tr><td><a href="Buf.html#TYPEdest">dest</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td align="left"><br>F</td></tr>
 <tr><td><a href="X11.html#TYPEfont">font</a> [<a href="X11.html">X11</a>]</td>
 <td></td></tr>
index e88a90c1abd59769d7cdcc268116bc89968195e7..4394030fac118cbeeb0aa5c0b3ea158a63174075 100644 (file)
 <h1>Index of values</h1>
 <table>
 <tr><td align="left"><br>B</td></tr>
-<tr><td><a href="Scrollmap.html#VALbonl">bonl</a> [<a href="Scrollmap.html">Scrollmap</a>]</td>
+<tr><td><a href="Buf.Cursor.html#VALbol">bol</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.html#VALbol">bol</a> [<a href="Buf.html">Buf</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.Color.Syntax.html#VALboolean">boolean</a> [<a href="Cfg.Color.Syntax.html">Cfg.Color.Syntax</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.html#VALboolvar">boolvar</a> [<a href="Cfg.html">Cfg</a>]</td>
 <td></td></tr>
-<tr><td><a href="Scrollmap.html#VALbopl">bopl</a> [<a href="Scrollmap.html">Scrollmap</a>]</td>
-<td></td></tr>
 <tr><td><a href="Cfg.Color.html#VALborders">borders</a> [<a href="Cfg.Color.html">Cfg.Color</a>]</td>
 <td></td></tr>
 <tr><td><a href="Draw.html#VALbuffer">buffer</a> [<a href="Draw.html">Draw</a>]</td>
 <td></td></tr>
 <tr><td><a href="Rope.html#VALempty">empty</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.Cursor.html#VALeol">eol</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.html#VALeol">eol</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td><a href="X11.html#VALevent_loop">event_loop</a> [<a href="X11.html">X11</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.html#VALevent_timeout">event_timeout</a> [<a href="Cfg.html">Cfg</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.html#VALintvar">intvar</a> [<a href="Cfg.html">Cfg</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.Cursor.html#VALis_at">is_at</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.html#VALis_at">is_at</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.Cursor.html#VALis_bol">is_bol</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.html#VALis_bol">is_bol</a> [<a href="Buf.html">Buf</a>]</td>
+<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.Cursor.html#VALiter">iter</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
 <td></td></tr>
 <tr><td><a href="Rope.html#VALmove_till">move_till</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.Cursor.html#VALmove_to">move_to</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.html#VALmove_to">move_to</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td align="left"><br>N</td></tr>
 <tr><td><a href="Draw.Cursor.html#VALnext_glyph">next_glyph</a> [<a href="Draw.Cursor.html">Draw.Cursor</a>]</td>
 <td></td></tr>
 <td></td></tr>
 <tr><td><a href="Buf.Cursor.html#VALnextc">nextc</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.html#VALnextc">nextc</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td><a href="Rope.html#VALnextc">nextc</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td><a href="Buf.Cursor.html#VALnextln">nextln</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.html#VALnextln">nextln</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td><a href="Rope.html#VALnextln">nextln</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.Color.Syntax.html#VALnormal">normal</a> [<a href="Cfg.Color.Syntax.html">Cfg.Color.Syntax</a>]</td>
 <td></td></tr>
 <tr><td><a href="Buf.Cursor.html#VALprevc">prevc</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.html#VALprevc">prevc</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td><a href="Rope.html#VALprevc">prevc</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td><a href="Buf.Cursor.html#VALprevln">prevln</a> [<a href="Buf.Cursor.html">Buf.Cursor</a>]</td>
 <td></td></tr>
+<tr><td><a href="Buf.html#VALprevln">prevln</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td><a href="Rope.html#VALprevln">prevln</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.Color.Syntax.html#VALprocedure">procedure</a> [<a href="Cfg.Color.Syntax.html">Cfg.Color.Syntax</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 5bc2e2f6771234bb4ee8279fe4538e4cb4da60d6..dd15c50f993ef0e39b7a560c12d4d9cc18a03215 100644 (file)
 &nbsp;&nbsp;&nbsp;&nbsp;(<span class="constructor">Buf</span>.<span class="constructor">Cursor</span>.csr&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;<span class="constructor">Rope</span>.rune&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;bool)&nbsp;<span class="keywordsign">-&gt;</span><br>
 &nbsp;&nbsp;&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;unit<br>
 &nbsp;&nbsp;<span class="keyword">val</span>&nbsp;getc&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;<span class="constructor">Rope</span>.rune<br>
+&nbsp;&nbsp;<span class="keyword">val</span>&nbsp;move_to&nbsp;:&nbsp;<span class="constructor">Buf</span>.dest&nbsp;<span class="keywordsign">-&gt;</span>&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;nextc&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;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;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>
+&nbsp;&nbsp;<span class="keyword">val</span>&nbsp;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;int<br>
+&nbsp;&nbsp;<span class="keyword">val</span>&nbsp;is_at&nbsp;:&nbsp;<span class="constructor">Buf</span>.dest&nbsp;<span class="keywordsign">-&gt;</span>&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;is_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;bool<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 1219ee3c35d4cade02ee68186c63c42dcf8a0f61..94a6fbb63b2620ddae6d7d2a67d56d529bfbdc16 100644 (file)
@@ -5,6 +5,11 @@ type buf = {
 
 type t = buf
 
+type dest =
+  | StartOfLine | EndOfLine
+  | NextChar | PrevChar
+  | NextLine | PrevLine
+
 let empty =
   { path = ""; rope = Rope.empty }
 
@@ -43,22 +48,45 @@ module Cursor = struct
   let getc buf csr =
     Rope.getc buf.rope csr.stop
 
-  let nextc buf csr =
-    csr.stop <- (Rope.nextc buf.rope csr.stop); csr.stop
-
-  let prevc buf csr =
-    csr.stop <- (Rope.prevc buf.rope csr.stop); csr.stop
-
-  let nextln buf csr =
-    csr.stop <- (Rope.nextln buf.rope csr.stop); csr.stop
-
-  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 move_to dest buf csr =
+    csr.stop <- (match dest with
+      | StartOfLine -> Rope.to_bol buf.rope csr.stop
+      | EndOfLine   -> Rope.to_eol buf.rope csr.stop
+      | NextChar    -> Rope.nextc buf.rope csr.stop
+      | PrevChar    -> Rope.prevc buf.rope csr.stop
+      | NextLine    -> Rope.nextln buf.rope csr.stop
+      | PrevLine    -> Rope.prevln buf.rope csr.stop
+    );
+    csr.stop
 
-  let to_bol buf csr =
-    csr.stop <- (Rope.to_bol buf.rope csr.stop); csr.stop
+  let nextc = move_to NextChar
+  let prevc = move_to PrevChar
+  let nextln = move_to NextLine
+  let prevln = move_to PrevLine
+  let bol = move_to StartOfLine
+  let eol = move_to EndOfLine
+
+  let is_at dest buf csr =
+    match dest with
+    | StartOfLine -> Rope.is_bol buf.rope csr.stop
+    | EndOfLine   -> Rope.is_eol buf.rope csr.stop
+    | _           -> false
+
+  let is_bol = is_at StartOfLine
+  let is_eol = is_at EndOfLine
 end
 
+let move_to dest buf i =
+  Cursor.move_to dest buf (Cursor.make buf i)
+let nextc = move_to NextChar
+let prevc = move_to PrevChar
+let nextln = move_to NextLine
+let prevln = move_to PrevLine
+let bol = move_to StartOfLine
+let eol = move_to EndOfLine
+let eol = move_to EndOfLine
+
+let is_at dest buf i =
+  Cursor.is_at dest buf (Cursor.make buf i)
+let is_bol = is_at StartOfLine
+let is_eol = is_at EndOfLine
index 4bf4215e4693f489124b97ad983cc48ca66318b1..496882d854ec1e8e675a563e2fb22cc319d71a17 100644 (file)
@@ -1,31 +1,52 @@
 type buf
 type t = buf
-val empty : t
-val load : string -> t
-val iter : (int -> bool) -> t -> int -> unit
-val iteri : (int -> int -> bool) -> t -> int -> unit
+type dest =
+  | StartOfLine | EndOfLine
+  | NextChar | PrevChar
+  | NextLine | PrevLine
 
 module Cursor : sig
   type t
+
   val make : buf -> int -> t
   val clone : t -> t
   val iter : (t -> int -> bool) -> buf -> t -> unit
   val offset : t -> int
   val goto : buf -> t -> int -> unit
+
   val getc : buf -> t -> int
 (*
   val putc : buf -> t -> int -> unit
   val gets : buf -> t -> string
   val puts : buf -> t -> string -> unit
 *)
+
+  val move_to : dest -> buf -> t -> int
   val nextc : buf -> t -> int
   val prevc : buf -> t -> int
   val nextln : buf -> t -> int
   val prevln : buf -> t -> int
-(*
+  val bol : buf -> t -> int
+  val eol : buf -> t -> int
+
+  val is_at : dest -> buf -> t -> bool
   val is_bol : buf -> t -> bool
-  val to_eol : buf -> t -> int
-*)
   val is_eol : buf -> t -> bool
-  val to_bol : buf -> t -> int
 end
+
+val empty : t
+val load : string -> t
+val iter : (int -> bool) -> t -> int -> unit
+val iteri : (int -> int -> bool) -> t -> int -> unit
+
+val move_to : dest -> t -> int -> int
+val nextc : t -> int -> int
+val prevc : t -> int -> int
+val nextln : t -> int -> int
+val prevln : t -> int -> int
+val bol : t -> int -> int
+val eol : t -> int -> int
+
+val is_at : dest -> t -> int -> bool
+val is_bol : t -> int -> bool
+val is_eol : t -> int -> bool
index 6cb8cd4baaa0fe1f4398a531cf2b384aa22c81c7..960633d21b5a78ee980da31e01851d4065ffce1f 100644 (file)
@@ -12,8 +12,7 @@ let rec find_line lines off idx =
 
 let make buf width off =
   let csr = Draw.Cursor.make (width, 0) 0 0 in
-  (*let bol = Buf.goto StartOfLine buf off in*)
-  let bol = Buf.Cursor.to_bol buf (Buf.Cursor.make buf off) in
+  let bol = Buf.bol buf off in
   let lines = ref [bol] in
   let process_glyph i c =
     let not_eol = (c != 0x0A) in
@@ -29,25 +28,21 @@ let make buf width off =
 let first map =
   map.lines.(map.index)
 
-let bopl buf off =
-  Buf.Cursor.prevln buf (Buf.Cursor.make buf off)
-
-let bonl buf off =
-  Buf.Cursor.nextln buf (Buf.Cursor.make buf off)
-
 let scroll_up map buf =
   let next = map.index - 1 in
   if (next >= 0) then
     { map with index = next }
   else
-    make buf map.width (bopl buf map.lines.(0))
+    let off = map.lines.(0) in
+    make buf map.width (Buf.prevln buf off)
 
 let scroll_dn map buf =
   let next = map.index + 1 in
   if (next < (Array.length map.lines)) then
     { map with index = next }
   else
-    make buf map.width (bonl buf map.lines.((Array.length map.lines) - 1))
+    let off = map.lines.((Array.length map.lines) - 1) in
+    make buf map.width (Buf.nextln buf off)
 
 let resize map buf width =
   if map.width == width then map