This time I'm no longer trying to find the ideal layering, just to graft it on somehow. As a result there'll be things it's not possible/convenient to change live.
LGB3TBXT2GXWJSY55THWW42FB4YTEL7POELSFVGUE5I2YLWTRAFAC YALIYM7CAHUXVK45JVRPQS226OZIWNHTIWJA5ABYXENUMFEJPRWQC MIKAQWHPJFAELPV7ATGH6DWR7V4FKHAOYMPAKVFFSGEUNE5IVIDQC KHPSHJN4BMTJ3CHUFQQZU7ZIQDOQDF3L5HV3TRT5OJMYICJAEB5QC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC AJB4LFRBMIRBEDWJ3OW7GQIMD2BZBVQ62GH4TE2FISWZKSAHRF4QC JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC GBSRQUT4QF5WCFVSTGSOU3BM6VCGPNBBG5WKDEGDGGCOUWTPEC2AC if #arg > 0 thenEditor_state.filename = arg[1]load_from_disk(Editor_state)Text.redraw_all(Editor_state)Editor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}elseload_from_disk(Editor_state)Text.redraw_all(Editor_state)endlove.window.setTitle('text.love - '..Editor_state.filename)
initialize_default_settings()
function load_settings()local settings = json.decode(love.filesystem.read('config'))love.graphics.setFont(love.graphics.newFont(settings.font_height))-- maximize window to determine maximum allowable dimensionsApp.screen.width, App.screen.height, App.screen.flags = love.window.getMode()-- set up desired window dimensionsApp.screen.flags.resizable = trueApp.screen.flags.minwidth = math.min(App.screen.width, 200)App.screen.flags.minheight = math.min(App.screen.width, 200)App.screen.width, App.screen.height = settings.width, settings.heightlove.window.setMode(App.screen.width, App.screen.height, App.screen.flags)love.window.setPosition(settings.x, settings.y, settings.displayindex)Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, settings.font_height, math.floor(settings.font_height*1.3))Editor_state.filename = settings.filenameEditor_state.screen_top1 = settings.screen_topEditor_state.cursor1 = settings.cursorend
-- save some important settingslocal x,y,displayindex = love.window.getPosition()local filename = Editor_state.filenameif is_relative_path(filename) thenfilename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windowsendlocal settings = {x=x, y=y, displayindex=displayindex,width=App.screen.width, height=App.screen.height,font_height=Editor_state.font_height,filename=filename,screen_top=Editor_state.screen_top1, cursor=Editor_state.cursor1}love.filesystem.write('config', json.encode(settings))
-- TODO: save settings