pothi.love/0010-initialize_editor

11 lines
439 B
Plaintext
Raw Normal View History

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)
obj.editor = edit.initialize_state(Menu_bar_height + vy(obj.y), math.floor(vx(obj.x)), math.ceil(vx(obj.x+obj.w)), scaled_fontsize, scaled_lineheight)
obj.editor.filename = obj.filename
obj.editor.lines = obj.data
Text.redraw_all(obj.editor)
end
end