]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
fixed bug in scrollmap creation that was creating empty lines
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 6 Nov 2017 21:05:09 +0000 (16:05 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 6 Nov 2017 21:05:09 +0000 (16:05 -0500)
edit.ml
lib/scrollmap.ml

diff --git a/edit.ml b/edit.ml
index b6f3ff0a6af3805aa7af480996a6f97592c3b0ef..1b3b4cc87d6a591f7ec0e4ca27d9fa9c1ae49cb8 100644 (file)
--- a/edit.ml
+++ b/edit.ml
@@ -35,10 +35,10 @@ let edit_view = ref (View.empty 640 480)
 let onfocus focused = ()
 
 let onkeypress mods rune =
-  edit_view := View.scroll_dn !edit_view
+  edit_view := View.scroll_up !edit_view
 
 let onmousebtn mods btn x y pressed =
-  match btn with
+  if pressed then match btn with
   | 1 -> ()
   | 2 -> ()
   | 3 -> ()
index 6852a26153b9809b1658f376f40f977b976ef212..8a8fefe891f5cb1a26d814034a953eac1eb1cc63 100644 (file)
@@ -15,9 +15,10 @@ let make buf width off =
   let bol = (Rope.to_bol (Buf.rope buf) off) in
   let lines = ref [bol] in
   let process_glyph i c =
-    if (Draw.Cursor.next_glyph csr c) then
+    let is_eol = (Rope.is_eol (Buf.rope buf) i) in
+    if (Draw.Cursor.next_glyph csr c) && is_eol == false then
       lines := i :: !lines;
-      ((Rope.is_eol (Buf.rope buf) i) == false)
+    (is_eol == false)
   in
   Buf.iteri_from process_glyph buf off;
   let lines = (Array.of_list (List.rev !lines)) in