experiment: simple hyperlinks just to local files
[?]
Aug 23, 2022, 10:13 PM
VG34LDWYWKMKO76MEKWLUV4RGZCY26LZNSGRA5U2EMAYNGB6LGXQCDependencies
- [2]
HALS7E5Umore clearly skip prints before screen top - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
WLHI7KD3new globals: draw partial screen line up top - [*]
OTIBCAUJlove2d scaffold - [*]
AVTNUQYRbasic test-enabled framework - [*]
VHQCNMARseveral more modules - [*]
2L5MEZV3experiment: new edit namespace - [*]
4KC7I3E2make colors easier to edit
Change contents
- edit in text.lua at line 40
end-- If fragment is a filename relative to the current directory, register-- a button for clicks on it.local filename = rtrim(frag) -- compute_fragments puts whitespace at the endif file_exists(filename) thenlocal filename_text = App.newText(love.graphics.getFont(), filename)button(State, 'link', {x=x,y=y, w=App.width(filename_text), h=State.line_height, color={1,1,1},icon = icon.hyperlink_decoration,onpress1 = function()switch_to_file(filename)end,}) - edit in main.lua at line 135
-- a copy of App.filedropped when given a filenamefunction switch_to_file(filename)-- first make sure to save edits on any existing fileif Editor_state.next_save thensave_to_disk(Editor_state)end-- clear the slate for the new file--? print('switching to', filename)Editor_state.filename = filenameload_from_disk(Editor_state)Text.redraw_all(Editor_state)Editor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}end - edit in icons.lua at line 9
endfunction icon.hyperlink_decoration(button_params)local x,y = button_params.x, button_params.yApp.color(Hyperlink_decoration_color)love.graphics.line(x,y+Editor_state.line_height, x+button_params.w,y+Editor_state.line_height) - edit in edit.lua at line 4[10.519][10.519]
Hyperlink_decoration_color = {r=0.4, g=0.4, b=1}