diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-05-20 22:16:51 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-05-20 22:17:47 -0700 |
commit | e3dc4c330b3d78aa2f1a360ce931974ef7b277d1 (patch) | |
tree | 7f499dfa7edecdb846f2a3d89fb7562600e81186 | |
parent | a3f72abbdeac2d251c4221f1cb42896587afd60b (diff) | |
download | text.love-e3dc4c330b3d78aa2f1a360ce931974ef7b277d1.tar.gz |
rename
-rw-r--r-- | text.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/text.lua b/text.lua index c94d8ce..4f1baf9 100644 --- a/text.lua +++ b/text.lua @@ -3,7 +3,7 @@ Text = {} local utf8 = require 'utf8' -local New_render = true +local Debug_new_render = true function Text.draw(line, line_width, line_index) love.graphics.setColor(0,0,0) @@ -15,7 +15,7 @@ function Text.draw(line, line_width, line_index) Text.compute_fragments(line, line_width) end line.screen_line_starting_pos = nil - if New_render then print('--') end + if Debug_new_render then print('--') end for _, f in ipairs(line.fragments) do local frag, frag_text = f.data, f.text -- render fragment @@ -24,7 +24,7 @@ function Text.draw(line, line_width, line_index) assert(x > 25) -- no overfull lines if line_index > Screen_top_line or pos > Top_screen_line_starting_pos then y = y + math.floor(15*Zoom) - if New_render then print('y', y) end + if Debug_new_render then print('y', y) end end x = 25 if line.screen_line_starting_pos == nil then @@ -33,9 +33,9 @@ function Text.draw(line, line_width, line_index) table.insert(line.screen_line_starting_pos, pos) end end - if New_render then print('checking to draw', pos, Top_screen_line_starting_pos) end + if Debug_new_render then print('checking to draw', pos, Top_screen_line_starting_pos) end if line_index > Screen_top_line or pos >= Top_screen_line_starting_pos then - if New_render then print('drawing '..frag) end + if Debug_new_render then print('drawing '..frag) end love.graphics.draw(frag_text, x,y, 0, Zoom) end -- render cursor if necessary @@ -51,7 +51,7 @@ function Text.draw(line, line_width, line_index) if line_index == Cursor_line and Cursor_pos == pos then Text.draw_cursor(x, y) end - New_render = false + Debug_new_render = false return y end -- manual tests: @@ -123,7 +123,7 @@ end -- Don't handle any keys here that would trigger love.textinput above. function Text.keychord_pressed(chord) - New_render = true + Debug_new_render = true if chord == 'return' then local byte_offset = utf8.offset(Lines[Cursor_line].data, Cursor_pos) table.insert(Lines, Cursor_line+1, {mode='text', data=string.sub(Lines[Cursor_line].data, byte_offset)}) |