about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-09-18 01:32:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-09-18 01:32:23 -0700
commit141d41aec536a960096e777cb9f6ceef08f121a1 (patch)
treea2e02ec41d33bb773d32bad6f9e4c160a82b70e9
parent936d3b4616007916c21fba86fec7a67b9ae72ea2 (diff)
downloadtext.love-141d41aec536a960096e777cb9f6ceef08f121a1.tar.gz
hide editor cursor while in file navigator
-rw-r--r--source.lua2
-rw-r--r--source_edit.lua4
-rw-r--r--source_text.lua6
3 files changed, 6 insertions, 6 deletions
diff --git a/source.lua b/source.lua
index c8c83a4..69b2d4f 100644
--- a/source.lua
+++ b/source.lua
@@ -222,7 +222,7 @@ function source.switch_to_file(filename)
 end
 
 function source.draw()
-  edit.draw(Editor_state)
+  edit.draw(Editor_state, --[[hide cursor?]] Show_file_navigator)
   if Show_log_browser_side then
     -- divider
     App.color(Divider_color)
diff --git a/source_edit.lua b/source_edit.lua
index c17ce26..4f55083 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -124,7 +124,7 @@ function edit.fixup_cursor(State)
   end
 end
 
-function edit.draw(State)
+function edit.draw(State, hide_cursor)
   State.button_handlers = {}
   App.color(Text_color)
   if #State.lines ~= #State.line_cache then
@@ -170,7 +170,7 @@ function edit.draw(State)
                      end,
         })
       end
-      y, State.screen_bottom1.pos, State.screen_bottom1.posB = Text.draw(State, line_index, y, startpos, startposB)
+      y, State.screen_bottom1.pos, State.screen_bottom1.posB = Text.draw(State, line_index, y, startpos, startposB, hide_cursor)
       y = y + State.line_height
 --?       print('=> y', y)
     elseif line.mode == 'drawing' then
diff --git a/source_text.lua b/source_text.lua
index 5959fd5..3e70343 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -4,7 +4,7 @@ AB_padding = 20  -- space in pixels between A side and B side
 
 -- draw a line starting from startpos to screen at y between State.left and State.right
 -- return the final y, and pos,posB of start of final screen line drawn
-function Text.draw(State, line_index, y, startpos, startposB)
+function Text.draw(State, line_index, y, startpos, startposB, hide_cursor)
   local line = State.lines[line_index]
   local line_cache = State.line_cache[line_index]
   line_cache.starty = y
@@ -18,7 +18,7 @@ function Text.draw(State, line_index, y, startpos, startposB)
       return y, screen_line_starting_pos
     end
     if Focus == 'edit' and State.cursor1.pos then
-      if State.search_term == nil then
+      if not hide_cursor and not State.search_term then
         if line_index == State.cursor1.line and State.cursor1.pos == pos then
           Text.draw_cursor(State, x, y)
         end
@@ -64,7 +64,7 @@ function Text.draw(State, line_index, y, startpos, startposB)
 --?   if line_index == 8 then print('a') end
   if Focus == 'edit' and State.cursor1.posB then
 --?     if line_index == 8 then print('b') end
-    if State.search_term == nil then
+    if not hide_cursor and not State.search_term then
 --?       if line_index == 8 then print('c', State.cursor1.line, State.cursor1.posB, line_index, pos) end
       if line_index == State.cursor1.line and State.cursor1.posB == pos then
         Text.draw_cursor(State, x, y)