about summary refs log tree commit diff stats
path: root/select.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-04-02 09:22:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-04-02 09:22:32 -0700
commit3547c18db6b9d508fb5c2399c124e33f4cc8c488 (patch)
treeefec742d0c0a10017b1af35ae1a586077ee0cb05 /select.lua
parent3bdaf97baab7fd03c53a91ebd11bf359ab97a5d3 (diff)
parent29f1687f3c6a494eb67029acbeefbf11571bbe2c (diff)
downloadview.love-3547c18db6b9d508fb5c2399c124e33f4cc8c488.tar.gz
Merge lines.love
Diffstat (limited to 'select.lua')
-rw-r--r--select.lua7
1 files changed, 2 insertions, 5 deletions
diff --git a/select.lua b/select.lua
index b7cf65f..0050895 100644
--- a/select.lua
+++ b/select.lua
@@ -58,15 +58,12 @@ function Text.draw_highlight(State, line, x,y, pos, lo,hi)
       lo_px = 0
     else
       local before = line.data:sub(pos_offset, lo_offset-1)
-      local before_text = App.newText(love.graphics.getFont(), before)
-      lo_px = App.width(before_text)
+      lo_px = App.width(before)
     end
 --?     print(lo,pos,hi, '--', lo_offset,pos_offset,hi_offset, '--', lo_px)
     local s = line.data:sub(lo_offset, hi_offset-1)
-    local text = App.newText(love.graphics.getFont(), s)
-    local text_width = App.width(text)
     App.color(Highlight_color)
-    love.graphics.rectangle('fill', x+lo_px,y, text_width,State.line_height)
+    love.graphics.rectangle('fill', x+lo_px,y, App.width(s),State.line_height)
     App.color(Text_color)
     return lo_px
   end