initialize_editor = function(obj) if obj.w then -- use an editor to wrap the text local scaled_fontsize = scale(20) local scaled_lineheight = math.floor(scaled_fontsize*1.3) -- HACK: modify obj.editor.left after initialization obj.editor = edit.initialize_state(Menu_bar_height + vy(obj.y), math.floor(vx(obj.x)), math.ceil(vx(obj.x+obj.w)), love.graphics.getFont(), scaled_fontsize, scaled_lineheight) obj.editor.left = obj.editor.left + Line_number_width*obj.editor.font:getWidth('m') obj.editor.width = obj.editor.right - obj.editor.left obj.editor.lines = load_array(obj.data) Text.redraw_all(obj.editor) end end