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FVRCUQC
MLG2OGU7OBWWPX5TDJQWTDTHSTM75WIMAW57546C4XLEVZQOYJ7AC
IEHG6OROGLZINLGZACEOD2PHQOM522TDUUF2UT6APHT42GUH2OXAC
function test_drop_file()
io.write('\ntest_drop_file')
App.screen.init{width=Margin_left+300, height=300}
App.filesystem['foo'] = 'abc\ndef\nghi\n'
local fake_dropped_file = {
opened = false,
getFilename = function(self)
return 'foo'
end,
open = function(self)
self.opened = true
end,
lines = function(self)
assert(self.opened)
return App.filesystem['foo']:gmatch('[^\n]+')
end,
close = function(self)
self.opened = false
end,
}
App.filedropped(fake_dropped_file)
check_eq(#Lines, 3, 'F - test_drop_file/#lines')
check_eq(Lines[1].data, 'abc', 'F - test_drop_file/lines:1')
check_eq(Lines[2].data, 'def', 'F - test_drop_file/lines:2')
check_eq(Lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
end
function test_drop_file_saves_previous()
io.write('\ntest_drop_file_saves_previous')
App.screen.init{width=Margin_left+300, height=300}
-- initially editing a file called foo that hasn't been saved to filesystem yet
Lines = load_array{'abc', 'def'}
Filename = 'foo'
schedule_save()
-- now drag a new file bar from the filesystem
App.filesystem['bar'] = 'abc\ndef\nghi\n'
local fake_dropped_file = {
opened = false,
getFilename = function(self)
return 'bar'
end,
open = function(self)
self.opened = true
end,
lines = function(self)
assert(self.opened)
return App.filesystem['bar']:gmatch('[^\n]+')
end,
close = function(self)
self.opened = false
end,
}
App.filedropped(fake_dropped_file)
-- filesystem now contains a file called foo
check_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')
end
if #arg > 0 then
Filename = arg[1]
Lines = load_from_disk(Filename)
Screen_top1 = {line=1, pos=1}
Cursor1 = {line=1, pos=1}
for i,line in ipairs(Lines) do
if line.mode == 'text' then
Cursor1.line = i
break
end
end
else
Lines = load_from_disk(Filename)
if Cursor1.line > #Lines or Lines[Cursor1.line].mode ~= 'text' then
for i,line in ipairs(Lines) do
if line.mode == 'text' then
Cursor1.line = i
break
end
end
end
end
love.window.setTitle('lines.love - '..Filename)
assert(#arg == 0)
Filename = Directory..os.date('/%Y/%m/%d/%H-%M-%S')
os.execute('mkdir -p '..dirname(Filename))
assert(not file_exists(Filename))
function App.filedropped(file)
-- first make sure to save edits on any existing file
if Next_save then
save_to_disk(Lines, Filename)
end
-- clear the slate for the new file
App.initialize_globals() -- in particular, forget all undo history
Filename = file:getFilename()
file:open('r')
Lines = load_from_file(file)
file:close()
for i,line in ipairs(Lines) do
if line.mode == 'text' then
Cursor1.line = i
break
end
end
love.window.setTitle('Text with Lines - '..Filename)
end
function dirname(path)
return string.gsub(path, "(.*)/.*", "%1")
end
function basename(path)
return string.gsub(path, ".*/(.*)", "%1")
end
# Plain text with lines
# capture.love
Sometimes you just want to capture a stray thought. Seeing unrelated text can
make it fly right out of your brain. This app gives you a blank slate every
time, and captures your thought to a single hard-coded directory tree. Other
apps can take it from there and help you browse that directory tree.
By default, lines.love reads/writes the file `lines.txt` in your default
user/home directory (`https://love2d.org/wiki/love.filesystem.getUserDirectory`).
To run capture.love, double-click on it. It can also be [invoked from the
terminal](https://love2d.org/wiki/Getting_Started#Running_Games).
To open a different file, drop it on the lines.love window.
lines.love can also be [invoked from the terminal](https://love2d.org/wiki/Getting_Started#Running_Games),
optionally with a file path to edit.
Side-effects: it writes to a unique file in the `pensieve` directory in your
default user/home directory (`https://love2d.org/wiki/love.filesystem.getUserDirectory`).
Updates to lines.love can be downloaded from the following mirrors in addition
to the website above:
* https://github.com/akkartik/lines.love
* https://repo.or.cz/lines.love.git
* https://codeberg.org/akkartik/lines.love
* https://tildegit.org/akkartik/lines.love
* https://git.tilde.institute/akkartik/lines.love
* https://git.sr.ht/~akkartik/lines.love
* https://pagure.io/lines.love
This repo is a fork of lines.love at http://akkartik.name/lines.html.
Updates to it can be downloaded from one of the following mirrors:
Forks of lines.love are encouraged. If you show me your fork, I'll link to it
here.
* https://github.com/akkartik/capture.love
* https://repo.or.cz/capture.love.git
* https://codeberg.org/akkartik/capture.love
* https://tildegit.org/akkartik/capture.love
* https://git.tilde.institute/akkartik/capture.love
* https://git.sr.ht/~akkartik/capture.love
* https://pagure.io/capture.love
* https://github.com/akkartik/lines-polygon-experiment -- an experiment that
uses separate shortcuts for regular polygons. `ctrl+3` for triangles,
`ctrl+4` for squares, etc.
Further forks are encouraged. If you show me your fork, I'll link to it here.