]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
broke view module out into it's own file and updated status to display filename
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 11 Nov 2017 03:46:16 +0000 (22:46 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 11 Nov 2017 03:46:16 +0000 (22:46 -0500)
45 files changed:
Makefile
docs/Buf.Cursor.html
docs/Buf.html
docs/Cfg.Color.Syntax.html
docs/Cfg.Color.html
docs/Cfg.html
docs/Draw.Cursor.html
docs/Draw.html
docs/Misc.html
docs/Rope.html
docs/Scrollmap.html
docs/View.html [new file with mode: 0644]
docs/X11.GlyphMap.html
docs/X11.Rune.html
docs/X11.html
docs/index.html
docs/index_attributes.html
docs/index_class_types.html
docs/index_classes.html
docs/index_exceptions.html
docs/index_extensions.html
docs/index_methods.html
docs/index_module_types.html
docs/index_modules.html
docs/index_types.html
docs/index_values.html
docs/type_Buf.Cursor.html
docs/type_Buf.html
docs/type_Cfg.Color.Syntax.html
docs/type_Cfg.Color.html
docs/type_Cfg.html
docs/type_Draw.Cursor.html
docs/type_Draw.html
docs/type_Misc.html
docs/type_Rope.html
docs/type_Scrollmap.html
docs/type_View.html [new file with mode: 0644]
docs/type_X11.GlyphMap.html
docs/type_X11.Rune.html
docs/type_X11.html
edit.ml
lib/buf.ml
lib/buf.mli
lib/rope.ml
lib/view.ml [new file with mode: 0644]

index a4088f1912aea6896455a1b6892bbd5bf13423ef..694943457d5f515c89556af0afe86009defe07e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,8 @@ LIBSRCS = \
        lib/rope.ml \
        lib/buf.ml \
        lib/draw.ml \
-       lib/scrollmap.ml
+       lib/scrollmap.ml \
+       lib/view.ml
 
 LIBOBJS = \
        $(LIBSRCS:.ml=.$(OBJEXT)) \
index 42b69e93b154666d5480098d33391dad1662236f..f55b43bac11c95e8eaebaa733b6ed7a4c32fcd91 100644 (file)
@@ -16,7 +16,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Buf.Cursor</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Buf.Cursor</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="Buf.html" title="Buf">Up</a>
index f2246c7e002086f3c734791e0836c23aabc69833..fef0b3986c931c2906465084f23714bb2a805277 100644 (file)
@@ -18,7 +18,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Buf</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Buf</title>
 </head>
 <body>
 <div class="navbar"><a class="pre" href="Rope.html" title="Rope">Previous</a>
 
 <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="VALpath"><span class="keyword">val</span> path</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> string</code></pre>
 <pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type"><a href="Buf.html#TYPEbuf">buf</a> -> int</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>
index 24bc7bfdc1c2c27395d50d942b2838f10c6df7ea..4e24f31169fa1af07383b6d34dcc63c2e9d7ebf4 100644 (file)
@@ -16,7 +16,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Cfg.Color.Syntax</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Cfg.Color.Syntax</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="Cfg.Color.html" title="Cfg.Color">Up</a>
index d52acd48d703cb87ec3cb0225383c9af32f29f8b..71da95216e8e90e3ce6df16e2f7c34c460223fc7 100644 (file)
@@ -16,7 +16,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Cfg.Color</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Cfg.Color</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="Cfg.html" title="Cfg">Up</a>
index 3db7037c38c4117106663d9ac65c5ff637467409..6a81cb1bc3cd658194acee129428c6ff4881c7d8 100644 (file)
@@ -18,7 +18,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Cfg</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Cfg</title>
 </head>
 <body>
 <div class="navbar"><a class="pre" href="X11.html" title="X11">Previous</a>
index 20875f9cf2e04142ab4c451fc47d69ef7406bbf6..6dd4c398ac2dedc1cbc8c42a5ec5d4d404c42950 100644 (file)
@@ -16,7 +16,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Draw.Cursor</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Draw.Cursor</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="Draw.html" title="Draw">Up</a>
index 534867c4e7f61ea341e296774ba068bf428f8d8e..92f03a4cae7cfe7babb22e766f4c967eebfe34e8 100644 (file)
@@ -18,7 +18,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Draw</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Draw</title>
 </head>
 <body>
 <div class="navbar"><a class="pre" href="Buf.html" title="Buf">Previous</a>
index 8182d2475e9f29da68c182f86c508a29d0b5d5f0..3f975b489d66e6e0e471a023394f23affe9c6bb1 100644 (file)
@@ -17,7 +17,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Misc</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Misc</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index cd7d93a9db56414e263a9f80b1ac213331d6e8f8..1dafc576bafe604542b64bfd652331e9a289cb71 100644 (file)
@@ -18,7 +18,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Rope</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Rope</title>
 </head>
 <body>
 <div class="navbar"><a class="pre" href="Cfg.html" title="Cfg">Previous</a>
index 35cb91cba9d5d00d37799c52ac1cd20785c0bf4e..be5b11d78ff425523cf6d0de1cf9a5f601bf6425 100644 (file)
@@ -6,6 +6,7 @@
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="Start" href="index.html">
 <link rel="previous" href="Draw.html">
+<link rel="next" href="View.html">
 <link rel="Up" href="index.html">
 <link title="Index of types" rel=Appendix href="index_types.html">
 <link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Scrollmap</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Scrollmap</title>
 </head>
 <body>
 <div class="navbar"><a class="pre" href="Draw.html" title="Draw">Previous</a>
 &nbsp;<a class="up" href="index.html" title="Index">Up</a>
-&nbsp;</div>
+&nbsp;<a class="post" href="View.html" title="View">Next</a>
+</div>
 <h1>Module <a href="type_Scrollmap.html">Scrollmap</a></h1>
 
 <pre><span class="keyword">module</span> Scrollmap: <code class="code">sig</code> <a href="Scrollmap.html">..</a> <code class="code">end</code></pre><hr width="100%">
diff --git a/docs/View.html b/docs/View.html
new file mode 100644 (file)
index 0000000..2d6e1fa
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<link rel="stylesheet" href="style.css" type="text/css">
+<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<link rel="Start" href="index.html">
+<link rel="previous" href="Scrollmap.html">
+<link rel="Up" href="index.html">
+<link title="Index of types" rel=Appendix href="index_types.html">
+<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
+<link title="Index of values" rel=Appendix href="index_values.html">
+<link title="Index of modules" rel=Appendix href="index_modules.html">
+<link title="Misc" rel="Chapter" href="Misc.html">
+<link title="X11" rel="Chapter" href="X11.html">
+<link title="Cfg" rel="Chapter" href="Cfg.html">
+<link title="Rope" rel="Chapter" href="Rope.html">
+<link title="Buf" rel="Chapter" href="Buf.html">
+<link title="Draw" rel="Chapter" href="Draw.html">
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>View</title>
+</head>
+<body>
+<div class="navbar"><a class="pre" href="Scrollmap.html" title="Scrollmap">Previous</a>
+&nbsp;<a class="up" href="index.html" title="Index">Up</a>
+&nbsp;</div>
+<h1>Module <a href="type_View.html">View</a></h1>
+
+<pre><span class="keyword">module</span> View: <code class="code">sig</code> <a href="View.html">..</a> <code class="code">end</code></pre><hr width="100%">
+
+<pre><code><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> = {</code></pre><table class="typetable">
+<tr>
+<td align="left" valign="top" >
+<code>&nbsp;&nbsp;</code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTt.num">num</span>&nbsp;: <code class="type">int</code>;</code></td>
+
+</tr>
+<tr>
+<td align="left" valign="top" >
+<code>&nbsp;&nbsp;</code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTt.buf">buf</span>&nbsp;: <code class="type"><a href="Buf.html#TYPEt">Buf.t</a></code>;</code></td>
+
+</tr>
+<tr>
+<td align="left" valign="top" >
+<code>&nbsp;&nbsp;</code></td>
+<td align="left" valign="top" >
+<code><span id="TYPEELTt.map">map</span>&nbsp;: <code class="type"><a href="Scrollmap.html#TYPEt">Scrollmap.t</a></code>;</code></td>
+
+</tr></table>
+}
+
+
+
+<pre><span id="VALfrom_buffer"><span class="keyword">val</span> from_buffer</span> : <code class="type"><a href="Buf.html#TYPEt">Buf.t</a> -> int -> 'a -> <a href="View.html#TYPEt">t</a></code></pre>
+<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">int -> 'a -> <a href="View.html#TYPEt">t</a></code></pre>
+<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">int -> 'a -> string -> <a href="View.html#TYPEt">t</a></code></pre>
+<pre><span id="VALpath"><span class="keyword">val</span> path</span> : <code class="type"><a href="View.html#TYPEt">t</a> -> string</code></pre>
+<pre><span id="VALresize"><span class="keyword">val</span> resize</span> : <code class="type"><a href="View.html#TYPEt">t</a> -> int -> <a href="View.html#TYPEt">t</a></code></pre>
+<pre><span id="VALdraw"><span class="keyword">val</span> draw</span> : <code class="type"><a href="View.html#TYPEt">t</a> -> <a href="Draw.Cursor.html#TYPEt">Draw.Cursor.t</a> -> <a href="View.html#TYPEt">t</a></code></pre>
+<pre><span id="VALscroll_up"><span class="keyword">val</span> scroll_up</span> : <code class="type"><a href="View.html#TYPEt">t</a> -> <a href="View.html#TYPEt">t</a></code></pre>
+<pre><span id="VALscroll_dn"><span class="keyword">val</span> scroll_dn</span> : <code class="type"><a href="View.html#TYPEt">t</a> -> <a href="View.html#TYPEt">t</a></code></pre>
+<pre><span id="VALscroll_params"><span class="keyword">val</span> scroll_params</span> : <code class="type"><a href="View.html#TYPEt">t</a> -> float * float</code></pre></body></html>
\ No newline at end of file
index aa799ed953c1a649426159b4172037daa4b303f2..e94cdda8ab0d67d8791e1850ede5bb72df329b02 100644 (file)
@@ -17,7 +17,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>X11.GlyphMap</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>X11.GlyphMap</title>
 </head>
 <body>
 <div class="navbar"><a class="pre" href="X11.Rune.html" title="X11.Rune">Previous</a>
index 3156c174ca9b18b62d01f351e5caac253c3790d9..2a9f928497433a573ab3afa24aaea8b8adbe326f 100644 (file)
@@ -17,7 +17,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>X11.Rune</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>X11.Rune</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="X11.html" title="X11">Up</a>
index 41d086d71a7b23bf368705c94146253ceec4491b..62712732426f7c47a4def2970393d27445a27ae6 100644 (file)
@@ -18,7 +18,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>X11</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>X11</title>
 </head>
 <body>
 <div class="navbar"><a class="pre" href="Misc.html" title="Misc">Previous</a>
index 995df80330c7cfc01488d80241804a372d88b044..d21b245527f9de922ebe21595f00cfa14dbe8667 100644 (file)
@@ -15,7 +15,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title></title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title></title>
 </head>
 <body>
 <h1></h1>
@@ -34,6 +35,7 @@
 <tr><td class="module"><a href="Buf.html">Buf</a></td><td></td></tr>
 <tr><td class="module"><a href="Draw.html">Draw</a></td><td></td></tr>
 <tr><td class="module"><a href="Scrollmap.html">Scrollmap</a></td><td></td></tr>
+<tr><td class="module"><a href="View.html">View</a></td><td></td></tr>
 </table>
 </body>
 </html>
\ No newline at end of file
index c0642f22a6ea1fa4dcd9835dd93747141e0fdd2e..09223333e88716c79c9e3c495889932fa3dec327 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of class attributes</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of class attributes</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index e4743e1690207294196ba63044a02453d88f609d..942121f6faf590df04a1805c90f3068c8c1f2811 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of class types</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of class types</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index b02809c26d59b02f4cdd01b814e82d8475f0f847..252701fefb7995ed80d703eab9ee21d202feb626 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of classes</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of classes</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index 79682f4a53d07631fc3ea77c93ef96e68f196d19..b674928e245a7328ac5053b29c0960967eda9c07 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of exceptions</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of exceptions</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index e14ae705d8f5f8a71082f7a9f589583d2281c38a..94be4bdf0cf2c520d9ed1fbd8e13c10015e2510b 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of extensions</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of extensions</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index e14ac8947a564345d243c449cfa374e3fb29a175..b125c726ab8782dc370d8c631c8864f4ae571326 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of class methods</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of class methods</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index b291d7782a3906dc4972ef40946cc2dce3e9bda3..bbf4bc8c720240957408722bb6bbfea33a17bd0e 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of module types</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of module types</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
index f7ab3ae95def26c04a63427cdc6cc0e6e90e0a1b..1407eb69c71d51268e623fc567f1c9dd07684dc1 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of modules</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of modules</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
@@ -52,6 +53,9 @@
 <td></td></tr>
 <tr><td><a href="Cfg.Color.Syntax.html">Syntax</a> [<a href="Cfg.Color.html">Cfg.Color</a>]</td>
 <td></td></tr>
+<tr><td align="left"><br>V</td></tr>
+<tr><td><a href="View.html">View</a> </td>
+<td></td></tr>
 <tr><td align="left"><br>X</td></tr>
 <tr><td><a href="X11.html">X11</a> </td>
 <td></td></tr>
index 79c783a9ad95fc8fba109bb3669e20197ab5d9d8..c9e1ebc5d23aa9cf27bcf8abf8d8857167349497 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of types</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of types</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
@@ -42,6 +43,8 @@
 <tr><td><a href="Rope.html#TYPErune">rune</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td align="left"><br>T</td></tr>
+<tr><td><a href="View.html#TYPEt">t</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="Scrollmap.html#TYPEt">t</a> [<a href="Scrollmap.html">Scrollmap</a>]</td>
 <td></td></tr>
 <tr><td><a href="Draw.Cursor.html#TYPEt">t</a> [<a href="Draw.Cursor.html">Draw.Cursor</a>]</td>
index 8e3364121706f7eff4331c1a490d9859538e5368..7e34b420261c204aeb36fc698cc3f9266480ccb8 100644 (file)
@@ -14,7 +14,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Index of values</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Index of values</title>
 </head>
 <body>
 <div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
@@ -68,6 +69,8 @@
 <td></td></tr>
 <tr><td><a href="X11.html#VALdisconnect">disconnect</a> [<a href="X11.html">X11</a>]</td>
 <td></td></tr>
+<tr><td><a href="View.html#VALdraw">draw</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="X11.html#VALdraw_char">draw_char</a> [<a href="X11.html">X11</a>]</td>
 <td></td></tr>
 <tr><td><a href="Draw.Cursor.html#VALdraw_glyph">draw_glyph</a> [<a href="Draw.Cursor.html">Draw.Cursor</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.html#VALedit_tags">edit_tags</a> [<a href="Cfg.html">Cfg</a>]</td>
 <td></td></tr>
+<tr><td><a href="View.html#VALempty">empty</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="Buf.html#VALempty">empty</a> [<a href="Buf.html">Buf</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="X11.html#VALfont_load">font_load</a> [<a href="X11.html">X11</a>]</td>
 <td></td></tr>
+<tr><td><a href="View.html#VALfrom_buffer">from_buffer</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="Rope.html#VALfrom_string">from_string</a> [<a href="Rope.html">Rope</a>]</td>
 <td></td></tr>
 <tr><td align="left"><br>G</td></tr>
 <tr><td><a href="Misc.html#VALload_file">load_file</a> [<a href="Misc.html">Misc</a>]</td>
 <td></td></tr>
 <tr><td align="left"><br>M</td></tr>
+<tr><td><a href="View.html#VALmake">make</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="Scrollmap.html#VALmake">make</a> [<a href="Scrollmap.html">Scrollmap</a>]</td>
 <td></td></tr>
 <tr><td><a href="Draw.Cursor.html#VALmake">make</a> [<a href="Draw.Cursor.html">Draw.Cursor</a>]</td>
 <tr><td align="left"><br>P</td></tr>
 <tr><td><a href="Cfg.Color.html#VALpalette">palette</a> [<a href="Cfg.Color.html">Cfg.Color</a>]</td>
 <td></td></tr>
+<tr><td><a href="View.html#VALpath">path</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
+<tr><td><a href="Buf.html#VALpath">path</a> [<a href="Buf.html">Buf</a>]</td>
+<td></td></tr>
 <tr><td><a href="Draw.Cursor.html#VALplace_glyph">place_glyph</a> [<a href="Draw.Cursor.html">Draw.Cursor</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.Color.Syntax.html#VALpreproc">preproc</a> [<a href="Cfg.Color.Syntax.html">Cfg.Color.Syntax</a>]</td>
 <tr><td align="left"><br>R</td></tr>
 <tr><td><a href="Draw.html#VALrectangle">rectangle</a> [<a href="Draw.html">Draw</a>]</td>
 <td></td></tr>
+<tr><td><a href="View.html#VALresize">resize</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="Scrollmap.html#VALresize">resize</a> [<a href="Scrollmap.html">Scrollmap</a>]</td>
 <td></td></tr>
 <tr><td><a href="Draw.Cursor.html#VALrestart">restart</a> [<a href="Draw.Cursor.html">Draw.Cursor</a>]</td>
 <tr><td align="left"><br>S</td></tr>
 <tr><td><a href="Draw.html#VALscroll">scroll</a> [<a href="Draw.html">Draw</a>]</td>
 <td></td></tr>
+<tr><td><a href="View.html#VALscroll_dn">scroll_dn</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="Scrollmap.html#VALscroll_dn">scroll_dn</a> [<a href="Scrollmap.html">Scrollmap</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.html#VALscroll_lines">scroll_lines</a> [<a href="Cfg.html">Cfg</a>]</td>
 <td></td></tr>
 <tr><td><a href="Cfg.Color.html#VALscroll_nor">scroll_nor</a> [<a href="Cfg.Color.html">Cfg.Color</a>]</td>
 <td></td></tr>
+<tr><td><a href="View.html#VALscroll_params">scroll_params</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
+<tr><td><a href="View.html#VALscroll_up">scroll_up</a> [<a href="View.html">View</a>]</td>
+<td></td></tr>
 <tr><td><a href="Scrollmap.html#VALscroll_up">scroll_up</a> [<a href="Scrollmap.html">Scrollmap</a>]</td>
 <td></td></tr>
 <tr><td><a href="X11.html#VALshow_window">show_window</a> [<a href="X11.html">X11</a>]</td>
index dd15c50f993ef0e39b7a560c12d4d9cc18a03215..4a11d65a8b0d5e060668057b2523080f45f240d4 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Buf.Cursor</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Buf.Cursor</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span><br>
index e7472aa86af43edb1ebca6e2d8d85143b188063b..bf8bd13ddc245a3a7532071862028d97ff3d28de 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Buf</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Buf</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
index 4058345985d0a3383d8d46dd4438bded5696aa97..a9c8a3110979ef82017185334ac7cf52aaab2be3 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Cfg.Color.Syntax</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Cfg.Color.Syntax</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span><br>
index 96343e57a0b41fea7c49a6bce7b3203399cbab38..e9aa915b68a3f01a9175aad26376363d087a5ccc 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Cfg.Color</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Cfg.Color</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span><br>
index 47691a6f51285cf63a5f11fccd28c6ff39ae1c83..f415608ac2868dfceebdeefe87a34e9eaff484c8 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Cfg</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Cfg</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
index c98866dd0f6a8706181c6a46ca13eb9a3e746d91..d39b6e8cb4a2759bde7e64f9119699569390a48a 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Draw.Cursor</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Draw.Cursor</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span><br>
index b9fab20245e8bfea802be2fedc6962807eca339c..e221ec0d1d54779a2f71ab5ea0d6f6cd70a56071 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Draw</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Draw</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
index 178e962eb7db9d2e80397e7f757ad36c399f29fe..705a85c9ef8a5f1242b47129c63b0a5594985573 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Misc</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Misc</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
index 12b9d519147b2cd2a7ced20101acabaa36c18b0d..b68790e999cbea7151224a320e934744c538459e 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Rope</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Rope</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
index 5c005c1f7431a302e0c9b0c1bbc5b9bba0ced160..7564240e871a3a10e88e6e0645cad4524ee2c1c6 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>Scrollmap</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>Scrollmap</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
diff --git a/docs/type_View.html b/docs/type_View.html
new file mode 100644 (file)
index 0000000..5a0496b
--- /dev/null
@@ -0,0 +1,20 @@
+<html><head>
+<link rel="stylesheet" href="style.css" type="text/css">
+<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<link rel="Start" href="index.html">
+<link title="Index of types" rel=Appendix href="index_types.html">
+<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
+<link title="Index of values" rel=Appendix href="index_values.html">
+<link title="Index of modules" rel=Appendix href="index_modules.html">
+<link title="Misc" rel="Chapter" href="Misc.html">
+<link title="X11" rel="Chapter" href="X11.html">
+<link title="Cfg" rel="Chapter" href="Cfg.html">
+<link title="Rope" rel="Chapter" href="Rope.html">
+<link title="Buf" rel="Chapter" href="Buf.html">
+<link title="Draw" rel="Chapter" href="Draw.html">
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>View</title>
+</head>
+<body>
+<code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
index c020538c202210ed17698ccc174609f21d9ece33..80ee296183f215c1d16b2f68db282fda7586de72 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>X11.GlyphMap</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>X11.GlyphMap</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span><br>
index 292a182e017c95496bd83e1d7e0d268e7246a802..35ae8cd68f2b167cc939a063f590e2ac048336cc 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>X11.Rune</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>X11.Rune</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;<span class="keyword">type</span>&nbsp;t&nbsp;=&nbsp;int&nbsp;<span class="keyword">val</span>&nbsp;compare&nbsp;:&nbsp;int&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;int&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;int&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
index f6f7286648ea9bed16a0f57d8f99ce3b7bc11849..faf9e8c4b1a6ab3ed8088f9152bb862d3d0f3c70 100644 (file)
@@ -13,7 +13,8 @@
 <link title="Rope" rel="Chapter" href="Rope.html">
 <link title="Buf" rel="Chapter" href="Buf.html">
 <link title="Draw" rel="Chapter" href="Draw.html">
-<link title="Scrollmap" rel="Chapter" href="Scrollmap.html"><title>X11</title>
+<link title="Scrollmap" rel="Chapter" href="Scrollmap.html">
+<link title="View" rel="Chapter" href="View.html"><title>X11</title>
 </head>
 <body>
 <code class="code"><span class="keyword">sig</span>&nbsp;&nbsp;<span class="keyword">end</span></code></body></html>
\ No newline at end of file
diff --git a/edit.ml b/edit.ml
index f690825fda8159470198db602631bdbef3c3e646..e45eb6940a9ca36ac58cee6ed66f88b04ee92e23 100644 (file)
--- a/edit.ml
+++ b/edit.ml
@@ -1,42 +1,5 @@
 open X11
 
-module View = struct
-  type t = {
-    num : int;
-    buf : Buf.t;
-    map : Scrollmap.t
-  }
-
-  let from_buffer buf width height =
-    { num = 0; buf = buf; map = Scrollmap.make buf width 0 }
-
-  let empty width height =
-    from_buffer (Buf.empty) width height
-
-  let make width height path =
-    from_buffer (Buf.load path) width height
-
-  let resize view width =
-    { view with map = Scrollmap.resize view.map view.buf width }
-
-  let draw view csr =
-    let view = (resize view (Draw.Cursor.max_width csr)) in
-    let num = Draw.buffer csr view.buf (Scrollmap.first view.map) in
-    { view with num = num }
-
-  let scroll_up view =
-    { view with map = Scrollmap.scroll_up view.map view.buf }
-
-  let scroll_dn view =
-    { view with map = Scrollmap.scroll_dn view.map view.buf }
-
-  let scroll_params view =
-    let length = float_of_int (Buf.length view.buf)
-    and first = float_of_int (Scrollmap.first view.map)
-    and nvisible = float_of_int view.num in
-    ((first /. length), (nvisible /. length))
-end
-
 let tags_buf = ref Buf.empty
 let edit_view = ref (View.empty 640 480)
 
@@ -60,7 +23,7 @@ let onmousemove mods x y = ()
 
 let onupdate width height =
   let csr = Draw.Cursor.make (width, height) 0 0 in
-  Draw.status csr "UNSI> *scratch*";
+  Draw.status csr (View.path !edit_view);
   Draw.tags csr !tags_buf;
   let scrollcsr = (Draw.Cursor.clone csr) in
   Draw.Cursor.move_x csr 15;
index ef6f37af66f95c4f062611a59b202afec38dc0ae..f139e9e072cfe34787faa52b31003e7bf917a687 100644 (file)
@@ -16,6 +16,9 @@ let empty =
 let load path =
   { path = path; rope = Rope.from_string (Misc.load_file path) }
 
+let path buf =
+  buf.path
+
 let length buf =
   Rope.length buf.rope
 
index 57f6304ff6f1ad82ae041210b625f9c9a1d83b51..9b8831b8347bceafb39c7ea47588e33cbe166242 100644 (file)
@@ -36,6 +36,7 @@ end
 
 val empty : t
 val load : string -> t
+val path : t -> string
 val length : t -> int
 val iter : (int -> bool) -> t -> int -> unit
 val iteri : (int -> int -> bool) -> t -> int -> unit
index d9759407497b46339495143374fe290066eca392..16e699a931792fffaa91367a0668b15605b198a3 100644 (file)
@@ -12,8 +12,6 @@ let empty = Leaf ("", 0, 0)
 let from_string s =
   Leaf (s, 0, (String.length s))
 
-(******************************************************************************)
-
 let length = function
   | Leaf (_,_,l)   -> l
   | Node (_,_,_,l) -> l
@@ -39,8 +37,6 @@ let check_index rope i =
   if i < 0 || i >= (length rope) then
     raise (Out_of_bounds "Rope.check_index")
 
-(******************************************************************************)
-
 let rec getb rope i =
   check_index rope i;
   match rope with
@@ -71,8 +67,6 @@ let rec getc rope i =
       else
         getc r (i - left_len)
 
-(******************************************************************************)
-
 (* inefficient form of iteri *)
 let rec iteri fn rope pos =
   if pos < (length rope) && (fn pos (Char.code (getb rope pos))) then
@@ -107,8 +101,6 @@ let gets rope i j =
     rope i;
   Bytes.unsafe_to_string buf
 
-(******************************************************************************)
-
 (* Rebalancing:
 
 * Height of leaf is 0
diff --git a/lib/view.ml b/lib/view.ml
new file mode 100644 (file)
index 0000000..fab1ed6
--- /dev/null
@@ -0,0 +1,37 @@
+type t = {
+  num : int;
+  buf : Buf.t;
+  map : Scrollmap.t
+}
+
+let from_buffer buf width height =
+  { num = 0; buf = buf; map = Scrollmap.make buf width 0 }
+
+let empty width height =
+  from_buffer (Buf.empty) width height
+
+let make width height path =
+  from_buffer (Buf.load path) width height
+
+let path view =
+  Buf.path view.buf
+
+let resize view width =
+  { view with map = Scrollmap.resize view.map view.buf width }
+
+let draw view csr =
+  let view = (resize view (Draw.Cursor.max_width csr)) in
+  let num = Draw.buffer csr view.buf (Scrollmap.first view.map) in
+  { view with num = num }
+
+let scroll_up view =
+  { view with map = Scrollmap.scroll_up view.map view.buf }
+
+let scroll_dn view =
+  { view with map = Scrollmap.scroll_dn view.map view.buf }
+
+let scroll_params view =
+  let length = float_of_int (Buf.length view.buf)
+  and first = float_of_int (Scrollmap.first view.map)
+  and nvisible = float_of_int view.num in
+  ((first /. length), (nvisible /. length))