about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-23 23:00:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-23 23:00:07 -0700
commite581a2b7d1175d0365aed2399537a2f2c4271099 (patch)
treebd88e31fabf4a9e24638e9b6bebd421a85279d3f
parent8d5ac5da75b853e833c7ad5f18ce468eebc2aa0b (diff)
downloadlines.love-e581a2b7d1175d0365aed2399537a2f2c4271099.tar.gz
get rid of debug variables
-rw-r--r--main.lua13
-rw-r--r--text.lua9
2 files changed, 6 insertions, 16 deletions
diff --git a/main.lua b/main.lua
index d313da9..e2a0e95 100644
--- a/main.lua
+++ b/main.lua
@@ -85,8 +85,6 @@ Zoom = 1.5
 
 Filename = love.filesystem.getUserDirectory()..'/lines.txt'
 
-Debug_main = false
-
   -- still in App.initialize
   if #arg > 0 then
     Filename = arg[1]
@@ -125,10 +123,9 @@ function App.draw()
     line.y = nil
   end
   local y = 15
-  if Debug_main then print('== draw') end
+--?   print('== draw')
   for line_index,line in ipairs(Lines) do
---?     print(y, line_index, line)
-    if Debug_main then print('draw:', line_index, y) end
+--?     print('draw:', y, line_index, line)
     if y + math.floor(15*Zoom) > App.screen.height then break end
 --?     print('a')
     if line_index >= Screen_top1.line then
@@ -153,15 +150,14 @@ function App.draw()
         Drawing.draw(line)
         y = y + Drawing.pixels(line.h) + 10 -- padding
       else
-        if Debug_main then print('text') end
+--?         print('text')
         line.y = y
         y, Screen_bottom1.pos = Text.draw(line, Line_width, line_index)
         y = y + math.floor(15*Zoom)  -- text height
-        if Debug_main then print('aa', y) end
+--?         print('=> y', y)
       end
     end
   end
-  Debug_main = false
 --?   print('screen bottom: '..tostring(Screen_bottom1.pos)..' in '..tostring(Lines[Screen_bottom1.line].data))
 --?   os.exit(1)
 end
@@ -202,7 +198,6 @@ function App.textinput(t)
 end
 
 function App.keychord_pressed(chord)
---?   Debug_main = true
   if love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then
     Drawing.keychord_pressed(chord)
   elseif chord == 'escape' and love.mouse.isDown('1') then
diff --git a/text.lua b/text.lua
index edb03d4..0f285e2 100644
--- a/text.lua
+++ b/text.lua
@@ -3,8 +3,6 @@ Text = {}
 
 local utf8 = require 'utf8'
 
-local Debug_new_render = false
-
 -- return values:
 --  y coordinate drawn until in px
 --  position of start of final screen line drawn
@@ -22,7 +20,7 @@ function Text.draw(line, line_width, line_index)
   if line.screen_line_starting_pos == nil then
     Text.populate_screen_line_starting_pos(line_index)
   end
-  if Debug_new_render then print('--') end
+--?   print('--')
   for _, f in ipairs(line.fragments) do
     local frag, frag_text = f.data, f.text
     -- render fragment
@@ -40,14 +38,13 @@ function Text.draw(line, line_width, line_index)
         end
         screen_line_starting_pos = pos
 --?         print('text: new screen line', y, App.screen.height, screen_line_starting_pos)
-        if Debug_new_render then print('y', y) end
       end
       x = 25
     end
 --?     print('checking to draw', pos, Screen_top1.pos)
     -- don't draw text above screen top
     if line_index > Screen_top1.line or (line_index == Screen_top1.line and pos >= Screen_top1.pos) then
-      if Debug_new_render then print('drawing '..frag) end
+--?       print('drawing '..frag)
       App.screen.draw(frag_text, x,y, 0, Zoom)
     end
     -- render cursor if necessary
@@ -63,7 +60,6 @@ function Text.draw(line, line_width, line_index)
   if line_index == Cursor1.line and Cursor1.pos == pos then
     Text.draw_cursor(x, y)
   end
-  Debug_new_render = false
   return y, screen_line_starting_pos
 end
 -- manual tests:
@@ -591,7 +587,6 @@ end
 
 -- Don't handle any keys here that would trigger love.textinput above.
 function Text.keychord_pressed(chord)
---?   Debug_new_render = true
   if chord == 'return' then
     local byte_offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
     table.insert(Lines, Cursor1.line+1, {mode='text', data=string.sub(Lines[Cursor1.line].data, byte_offset)})