about summary refs log tree commit diff stats
path: root/source_text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-09-15 23:56:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-09-15 23:56:49 -0700
commit09c76c82c2a415839ad0d50d9fc14e883caeae6e (patch)
tree104401a62623498d9cf9eabe50159e6eec1668f3 /source_text.lua
parent1a88b4a2907a78fd4a1febf32c74d0305aff6ba0 (diff)
parent715c6fd32fadf8b14f4755cc31bacfb21c7f7dac (diff)
downloadtext.love-09c76c82c2a415839ad0d50d9fc14e883caeae6e.tar.gz
Merge lines.love
Diffstat (limited to 'source_text.lua')
-rw-r--r--source_text.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/source_text.lua b/source_text.lua
index 68b560e..df36266 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -3,7 +3,7 @@ Text = {}
 
 -- draw a line starting from startpos to screen at y between State.left and State.right
 -- return y for the next line, and position of start of final screen line drawn
-function Text.draw(State, line_index, y, startpos, hide_cursor)
+function Text.draw(State, line_index, y, startpos, hide_cursor, show_line_numbers)
   local line = State.lines[line_index]
   local line_cache = State.line_cache[line_index]
   line_cache.starty = y
@@ -12,8 +12,10 @@ function Text.draw(State, line_index, y, startpos, hide_cursor)
   local final_screen_line_starting_pos = startpos  -- track value to return
   Text.populate_screen_line_starting_pos(State, line_index)
   Text.populate_link_offsets(State, line_index)
-  App.color(Line_number_color)
-  love.graphics.print(line_index, State.left-Line_number_width*App.width('m')+10,y)
+  if show_line_numbers then
+    App.color(Line_number_color)
+    love.graphics.print(line_index, State.left-Line_number_width*App.width('m')+10,y)
+  end
   initialize_color()
   assert(#line_cache.screen_line_starting_pos >= 1)
   for i=1,#line_cache.screen_line_starting_pos do