From b5451e4351c9046b467b9efb669f0bd1929e3204 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 20 Jul 2022 06:55:14 -0700 Subject: move a var closer to its use --- text.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'text.lua') diff --git a/text.lua b/text.lua index a1d9ce6..4c4ab4a 100644 --- a/text.lua +++ b/text.lua @@ -26,8 +26,6 @@ function Text.draw(State, line_index, y, startpos) --? print('--') for _, f in ipairs(line_cache.fragments) do local frag, frag_text = f.data, f.text - -- render fragment - local frag_width = App.width(frag_text) local frag_len = utf8.len(frag) --? local s=tostring --? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(right)..') '..s(line_index)..' vs '..s(State.screen_top1.line)..'; '..s(pos)..' vs '..s(State.screen_top1.pos)..'; bottom: '..s(State.screen_bottom1.line)..'/'..s(State.screen_bottom1.pos)) @@ -35,6 +33,8 @@ function Text.draw(State, line_index, y, startpos) -- render nothing --? print('skipping', frag) else + -- render fragment + local frag_width = App.width(frag_text) if x + frag_width > State.right then assert(x > State.left) -- no overfull lines y = y + State.line_height -- cgit 1.4.1-2-gfad0