about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--log_browser.lua4
-rw-r--r--source.lua2
-rw-r--r--source_text.lua3
-rw-r--r--text.lua1
4 files changed, 6 insertions, 4 deletions
diff --git a/log_browser.lua b/log_browser.lua
index e011886..078db06 100644
--- a/log_browser.lua
+++ b/log_browser.lua
@@ -84,7 +84,7 @@ function guess_source(filename)
   end
 end
 
-function log_browser.draw(State)
+function log_browser.draw(State, hide_cursor)
   assert(#State.lines == #State.line_cache)
   local mouse_line_index = log_browser.line_index(State, App.mouse_x(), App.mouse_y())
   local y = State.top
@@ -117,7 +117,7 @@ function log_browser.draw(State)
         if type(line.data) == 'string' then
           local old_left, old_right = State.left,State.right
           State.left,State.right = xleft,xright
-          Text.draw(State, line_index, y, --[[startpos]] 1)
+          Text.draw(State, line_index, y, --[[startpos]] 1, hide_cursor)
           State.left,State.right = old_left,old_right
         else
           height = log_render[line.data.name](line.data, xleft, y, xright-xleft)
diff --git a/source.lua b/source.lua
index d43fbba..a0a2929 100644
--- a/source.lua
+++ b/source.lua
@@ -265,7 +265,7 @@ function source.draw()
     App.color(Divider_color)
     love.graphics.rectangle('fill', App.screen.width/2-1,Menu_status_bar_height, 3,App.screen.height)
     --
-    log_browser.draw(Log_browser_state)
+    log_browser.draw(Log_browser_state, --[[hide_cursor]] Focus ~= 'log_browser')
   end
   source.draw_menu_bar()
 end
diff --git a/source_text.lua b/source_text.lua
index 30f4bd4..290d982 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -181,7 +181,7 @@ function Text.clip_wikiword_with_screen_line(line, line_cache, i, s, e)
     hoff = e
   end
 --?   print(s, e, soff, eoff, loff, hoff)
-  return App.width(line.data:sub(1, loff-1)), App.width(line.data:sub(1, hoff))
+  return App.width(line.data:sub(soff, loff-1)), App.width(line.data:sub(soff, hoff))
 end
 
 function Text.text_input(State, t)
@@ -486,6 +486,7 @@ end
 function Text.down(State)
   assert(State.lines[State.cursor1.line].mode == 'text')
 --?   print('down', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
+  assert(State.cursor1.pos)
   if Text.cursor_at_final_screen_line(State) then
     -- line is done, skip to next text line
 --?     print('cursor at final screen line of its line')
diff --git a/text.lua b/text.lua
index 024b358..0d352ab 100644
--- a/text.lua
+++ b/text.lua
@@ -281,6 +281,7 @@ end
 
 function Text.down(State)
 --?   print('down', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
+  assert(State.cursor1.pos)
   if Text.cursor_at_final_screen_line(State) then
     -- line is done, skip to next text line
 --?     print('cursor at final screen line of its line')