fa778f95a1
When I stopped running the version check before the tests I also stopped initializing Version, which can be used in tests to watch out for font changes across versions. As a result I started seeing a test failure with LÖVE v12. It looks like all manual tests pass now. And we're also printing the warning about version checks before running tests, which can come in handy if a new version ever causes test failures. The only thing that makes me unhappy is the fact that we're calling the version check twice. And oh, the fact that this part around initialization and version management is clearly still immature. I'll capture some desires and fragmentary thought processes around them: * If there's an error, go to the source editor. * But oh, don't go to source editor on some unactionable errors, so we include a new `Current_app` mode for them: * Unsupported version requires an expert. Just muddle through if you can or give a warning someone can send me. * A failing test might be spurious depending on the platform and font rendering scheme. So again just provide a warning someone can send me. [Source editor can be confusing for errors. Also an editor! But not showing the file you asked for!] * But our framework clears the warning after running tests: * If someone is deep in developing a new feature and quits -> restore back in the source editor. [Perhaps `Current_app` is the wrong place for this third hacky mode, since we actually want to continue running. Perhaps it's orthogonal to `Current_app`.] [Ideally I wouldn't run the tests after the version check. I'd pause, wait for a key and then resume tests? "Muddle through" is a pain to orchestrate.] * We store `Current_app` in settings. But we don't really intend to persist a `Current_app` of 'error'. Only the main app or 'source' editor. [Another vote against storing 'error' in `Current_app`.] * So we need to rerun the version check after running tests to actually show the warning. [Perhaps I need to separate out the side-effect of setting `Version` from the side-effect of changing `Current_app`. But that's not right either, because I do still want to raise an error message if the version check fails before running tests. Which brings us back to wanting to run the tests after raising the version check..] One good thing: none of the bugs so far have been about silently ignoring test failures. I thought that might be the case for a bit, which was unnerving. I grew similar muddiness in Mu's bootstrap system over time, with several surrounding modes around the core program that interacted poorly or at least unsatisfyingly with each other. On one level it just feels like this outer layer reflects muddy constraints in the real world. But perhaps there's some skill I still need to learn here.. Why am I even displaying this error if we're going to try to muddle through anyway? In (vain) hopes that someone will send me that information. It's not terribly actionable even to me. But it's really intended for when making changes. If a test fails then, you want to know. The code would be cleaner if I just threw an unrecoverable error from the version check. Historically, the way I arrived at this solution was: * I used the default love.errorhandler for a while * I added xpcall and error recovery, but now I have situations where I would rather fall back on love.errorhandler. How to tell xpcall that? But no, this whole line of thought is wrong. LÖVE has a precedent for trying to muddle through on an unexpected version. And spurious test failures don't merit a hard crash. There's some irreducible requirement here. No point making the code simplistic when the world is complex. Perhaps I should stop caching Version and just recompute it each time. It's only used once so far, hardly seems worth the global. We have two bits of irreducible complexity here: * If tests fail it might be a real failure, or it might not. * Even if it's an unexpected version, everything might be fine. And the major remaining problem happens at the intersection of these two bits. What if we get an unexpected version with some difference that causes tests to fail? But this is a hypothetical and not worth thinking about since I'll update the app fairly quickly in response to new versions. |
||
---|---|---|
LICENSE.txt | ||
Manual_tests.md | ||
MemoryReferenceInfo.lua.0 | ||
MemoryReferenceInfo.lua.unused | ||
README.md | ||
app.lua | ||
button.lua | ||
colorize.lua | ||
commands.lua | ||
drawing.lua | ||
drawing_tests.lua | ||
edit.lua | ||
file.lua | ||
geom.lua | ||
help.lua | ||
icons.lua | ||
json.lua | ||
keychord.lua | ||
log.lua | ||
log_browser.lua | ||
main.lua | ||
nativefs.lua | ||
reference.md | ||
run.lua | ||
run_tests.lua | ||
search.lua | ||
select.lua | ||
source.lua | ||
source_edit.lua | ||
source_file.lua | ||
source_select.lua | ||
source_tests.lua | ||
source_text.lua | ||
source_text_tests.lua | ||
source_undo.lua | ||
test.lua | ||
text.lua | ||
text_tests | ||
text_tests.lua | ||
undo.lua |
README.md
Plain text with lines
An editor for plain text where you can also seamlessly insert line drawings. Designed above all to be easy to modify and give you early warning if your modifications break something.
http://akkartik.name/lines.html
Getting started
Install LÖVE. It's just a 5MB download, open-source and
extremely well-behaved. I'll assume below that you can invoke it using the
love
command, but that might vary depending on your OS.
To run from the terminal, pass this directory to LÖVE, optionally with a file path to edit.
Alternatively, turn it into a .love file you can double-click on:
$ zip -r /tmp/lines.love *.lua
By default, lines.love reads/writes the file lines.txt
in
a directory relative to this app.
To open a different file, drop it on the lines.love window.
Keyboard shortcuts
While editing text:
ctrl+f
to find patterns within a filectrl+c
to copy,ctrl+x
to cut,ctrl+v
to pastectrl+z
to undo,ctrl+y
to redoctrl+=
to zoom in,ctrl+-
to zoom out,ctrl+0
to reset zoomalt+right
/alt+left
to jump to the next/previous word, respectively- mouse drag or
shift
+ movement to select text,ctrl+a
to select all ctrl+e
to modify the sources
For shortcuts while editing drawings, consult the online help. Either:
- hover on a drawing and hit
ctrl+h
, or - click on a drawing to start a stroke and then press and hold
h
to see your options at any point during a stroke.
lines.love has been exclusively tested so far with a US keyboard layout. If you use a different layout, please let me know if things worked, or if you found anything amiss: http://akkartik.name/contact
Known issues
-
No support yet for Unicode graphemes spanning multiple codepoints.
-
No support yet for right-to-left languages.
-
Undo/redo may be sluggish in large files. Large files may grow sluggish in other ways. lines.love works well in all circumstances with files under 50KB.
-
If you kill the process, say by force-quitting because things things get sluggish, you can lose data.
-
The text cursor will always stay on the screen. This can have some strange implications:
- A long series of drawings will get silently skipped when you hit page-down, until a line of text can be showed on screen.
- If there's no line of text at the top of the file, you may not be able to scroll back up to the top with page-up.
So far this app isn't really designed for drawing-heavy files. For now I'm targeting mostly-text files with a few drawings mixed in.
-
No clipping yet for drawings. In particular, circles/squares/rectangles and point labels can overflow a drawing.
-
Touchpads can drag the mouse pointer using a light touch or a heavy click. On Linux, drags using the light touch get interrupted when a key is pressed. You'll have to press down to drag.
-
Can't scroll while selecting text with mouse.
-
No scrollbars yet. That stuff is hard.
Mirrors and Forks
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://tildegit.org/akkartik/lines.love
- https://git.tilde.institute/akkartik/lines.love
- https://git.sr.ht/~akkartik/lines.love
- https://notabug.org/akkartik/lines.love
- https://codeberg.org/akkartik/lines.love
- https://pagure.io/lines.love
- https://nest.pijul.com/akkartik/lines.love (using the Pijul version control system)
Forks of lines.love are encouraged. If you show me your fork, I'll link to it here.
- 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. - https://git.sr.ht/~akkartik/text.love -- a stripped down version without drawings; useful starting point for some forks
- https://git.sr.ht/~akkartik/pensieve.love -- a note-taking app on an infinite 2D surface. Still in development.
- https://git.sr.ht/~akkartik/capture.love -- a blank-slate mode for the note-taking app, so all the stuff pensieve.love puts on screen doesn't cause you to forget what you came to write down.
Associated tools
- https://codeberg.org/akkartik/lines2md exports lines.love files to Markdown and (non-editable) SVG.
- https://git.sr.ht/~akkartik/lines2html.love exports lines.love files to html and inline SVG.