about summary refs log tree commit diff stats
path: root/search.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-12 16:08:24 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-12 16:20:20 -0700
commit3874f325f8e1c71c067ed4dd3e9caa6fc3a254fc (patch)
tree92c96ea4c882702dd92a3a2cd780c991b35bfd4d /search.lua
parent92ad99853e8a38aa62e2246e372505ed0d1aff09 (diff)
downloadview.love-3874f325f8e1c71c067ed4dd3e9caa6fc3a254fc.tar.gz
add state arg to some functions
  - Text.draw
  - Text.draw_cursor
  - Text.draw_search_bar
Diffstat (limited to 'search.lua')
-rw-r--r--search.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/search.lua b/search.lua
index 5d794f2..64973c3 100644
--- a/search.lua
+++ b/search.lua
@@ -1,7 +1,7 @@
 -- helpers for the search bar (C-f)
 
-function Text.draw_search_bar()
-  local h = Editor_state.line_height+2
+function Text.draw_search_bar(State)
+  local h = State.line_height+2
   local y = App.screen.height-h
   love.graphics.setColor(0.9,0.9,0.9)
   love.graphics.rectangle('fill', 0, y-10, App.screen.width-1, h+8)
@@ -12,12 +12,12 @@ function Text.draw_search_bar()
   love.graphics.setColor(0.6,0.6,0.6)
   love.graphics.rectangle('line', 20, y-6, App.screen.width-40, h+2, 2,2)
   App.color(Text_color)
-  App.screen.print(Editor_state.search_term, 25,y-5)
+  App.screen.print(State.search_term, 25,y-5)
   App.color(Cursor_color)
-  if Editor_state.search_text == nil then
-    Editor_state.search_text = App.newText(love.graphics.getFont(), Editor_state.search_term)
+  if State.search_text == nil then
+    State.search_text = App.newText(love.graphics.getFont(), State.search_term)
   end
-  love.graphics.circle('fill', 25+App.width(Editor_state.search_text),y-5+h, 2)
+  love.graphics.circle('fill', 25+App.width(State.search_text),y-5+h, 2)
   App.color(Text_color)
 end