R56CKHYZLUOTRK42EKTFC4KUUYI76PREFVFE2YKCZCODFKIJKAQQC
HOUCPP7P4ZDHNMPNUGSU3BI6GCH5MA4I22UCRM2CJPO5IGEZZQ7QC
TPGGOVD4AR6HGCFTXTHSHTDMJCQVFDVSHZTPZIOON74PSUZI7SRAC
U3MJNFUY4ER65BIKP4D7JGVYWFPXA55KBJYD4RH5KRRKRQXBAW5AC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC
3PSFWAILGRA4OYXWS2DX7VF332AIBPYBXHEA4GIQY2XEJVD65UMAC
W5H5YI6SQD2OZYEX4E3RX7WKBHH4FKKJAD4TQVPQK64LGXZGOTJAC
KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC
36Z442IVPXHZ7D2QI26YLN3TDDEMDRQ2GKBYQAD6NUHQZVCCY4VAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
7VGDIPLCFDG3PVE4JH3WDKZ4A7PG5UYW7TLFFFOWN2JEUZYYTFJQC
2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC
MD3W5IRAC6UQALQE4LJC52VQNDO3I3HXF3XE2XHDABXBYJBUVAXQC
State.cursor1 = {line=i, pos=1}
break
end
end
end
function edit.check_locs(State)
-- if State is inconsistent (i.e. file changed by some other program),
-- throw away all cursor state entirely
if edit.invalid1(State, State.screen_top1)
or edit.invalid1(State, State.cursor1)
or not edit.cursor_on_text(State)
or not Text.le1(State.screen_top1, State.cursor1) then
State.screen_top1 = {line=1, pos=1}
edit.put_cursor_on_first_text_line(State)
end
end
function edit.invalid1(State, loc1)
return loc1.line > #State.lines
or loc1.pos > #State.lines[loc1.line].data
end
function edit.cursor_on_text(State)
return State.cursor1.line <= #State.lines
and State.lines[State.cursor1.line].mode == 'text'
end
function edit.put_cursor_on_first_text_line(State)
for i,line in ipairs(State.lines) do
if line.mode == 'text' then
edit.check_locs(Editor_state)
-- We currently start out with side B collapsed.
-- Other options:
-- * save all expanded state by line
-- * expand all if any location is in side B
if Editor_state.cursor1.line > #Editor_state.lines then
Editor_state.cursor1 = {line=1, pos=1}
end
if Editor_state.screen_top1.line > #Editor_state.lines then
Editor_state.screen_top1 = {line=1, pos=1}
end
edit.eradicate_locations_after_the_fold(Editor_state)
if rawget(_G, 'jit') then
jit.off()
jit.flush()
end
end
function source.load_settings()
local settings = Settings.source
love.graphics.setFont(love.graphics.newFont(settings.font_height))
-- maximize window to determine maximum allowable dimensions
edit.check_locs(Editor_state)
love.window.setTitle('text.love - '..Editor_state.filename)
end
function run.draw()
edit.draw(Editor_state)
end
function run.update(dt)
Cursor_time = Cursor_time + dt
edit.update(Editor_state, dt)
end
function run.quit()
edit.quit(Editor_state)
end
function run.settings()
edit.check_locs(Editor_state)
love.window.setTitle('text.love - '..Editor_state.filename)
if #arg > 1 then
print('ignoring commandline args after '..arg[1])
end
if rawget(_G, 'jit') then
jit.off()
jit.flush()
end
end
function run.load_settings()
love.graphics.setFont(love.graphics.newFont(Settings.font_height))
or not Text.le1(State.screen_top1, State.cursor1) then
State.screen_top1 = {line=1, pos=1}
State.cursor1 = {line=1, pos=1}
end
end
function edit.invalid1(State, loc1)
return loc1.line > #State.lines
or loc1.pos > #State.lines[loc1.line].data
end