Merge template-live-editor
This commit is contained in:
commit
e7bd6c196c
2
0001-on
2
0001-on
|
@ -8,7 +8,7 @@ on = {
|
|||
-- on.draw
|
||||
-- on.update
|
||||
-- on.resize
|
||||
-- on.file_drop
|
||||
-- on.file_drop (see love.filedropped)
|
||||
-- on.focus
|
||||
-- on.mouse_press (see love.mousepressed)
|
||||
-- on.mouse_release (see love.mousereleased)
|
||||
|
|
8
live.lua
8
live.lua
|
@ -49,8 +49,8 @@ function live.load_files_so_far()
|
|||
if io.open(love.filesystem.getSaveDirectory()..'/0000-freewheeling-start') == nil then
|
||||
print('copying all definitions from repo to save dir')
|
||||
for _,filename in ipairs(love.filesystem.getDirectoryItems('')) do
|
||||
for numeric_prefix, root in filename:gmatch('(%d+)-(.+)') do
|
||||
-- only runs once
|
||||
local numeric_prefix, root = filename:match('^(%d+)-(.+)')
|
||||
if numeric_prefix then
|
||||
local buf = love.filesystem.read(filename)
|
||||
print('copying', filename)
|
||||
love.filesystem.write(filename, buf)
|
||||
|
@ -59,8 +59,8 @@ function live.load_files_so_far()
|
|||
end
|
||||
-- load files from save dir
|
||||
for _,filename in ipairs(love.filesystem.getDirectoryItems('')) do
|
||||
for numeric_prefix, root in filename:gmatch('(%d+)-(.+)') do
|
||||
-- only runs once
|
||||
local numeric_prefix, root = filename:match('^(%d+)-(.+)')
|
||||
if numeric_prefix then
|
||||
if tonumber(numeric_prefix) > 0 then -- skip 0000
|
||||
Live.filename[root] = filename
|
||||
table.insert(Live.filenames_to_load, filename)
|
||||
|
|
|
@ -205,6 +205,9 @@ early warning if you break something.
|
|||
`x=right`. Wraps long lines at word boundaries where possible, or in the
|
||||
middle of words (no hyphenation yet) when it must.
|
||||
|
||||
* `state.lines = load_array(lines)` -- loads the editor state with the array
|
||||
of `lines`
|
||||
|
||||
* `edit.quit()` -- calling this ensures any final edits are flushed to disk
|
||||
before the app exits.
|
||||
|
||||
|
@ -230,7 +233,9 @@ early warning if you break something.
|
|||
buffer.
|
||||
|
||||
* `Text.redraw_all(state)` -- call this to clear and recompute any cached
|
||||
state as the cursor moves and the buffer scrolls.
|
||||
state as the cursor moves and the buffer scrolls. You shouldn't need to do
|
||||
this for the most part, just run it after loading or modifying
|
||||
`state.lines`.
|
||||
|
||||
If you need more precise control, look at the comment at the top of
|
||||
`edit.initialize_state` in edit.lua. In brief, the widget contains an array of
|
||||
|
|
Loading…
Reference in New Issue