sokoban.love/README.md

93 lines
3.9 KiB
Markdown
Raw Normal View History

2023-01-08 16:11:15 +00:00
# Example "freewheeling" app that can be modified without being restarted
2022-08-14 17:17:53 +01:00
2023-01-08 16:11:15 +00:00
Running this repo in isolation won't be very helpful. If you haven't yet,
2023-01-23 08:49:48 +00:00
first check out [the driver app](https://git.sr.ht/~akkartik/driver.love).
2023-01-08 16:11:15 +00:00
This repo is a template you can copy to create your own live apps that juggle
text editor widgets. The editors support copy/paste, search, infinite undo,
etc. You can't modify editor functionality live (yet?).
2023-05-30 09:11:12 +01:00
[Some reference documentation on how to create your own apps.](reference.md)
2023-07-01 21:22:05 +01:00
This repo is an example of a [Freewheeling App](http://akkartik.name/freewheeling),
designed above all to be easy to run, easy to modify and easy to share.
2022-06-07 02:33:44 +01:00
2023-01-25 02:46:40 +00:00
## Getting started
Install [LÖVE](https://love2d.org). 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.
2023-01-08 16:11:15 +00:00
Run this app from the terminal, [passing its directory to LÖVE](https://love2d.org/wiki/Getting_Started#Running_Games)
2022-06-07 02:33:44 +01:00
new file-system format for freewheeling apps 1. No more version history, now we have just the contents of the current version. 2. Editing a definition no longer changes the order in which definitions load. This should make repos easier to browse, and more amenable to modify. You don't need driver.love anymore. And a stable order eliminates some gotchas. For example: using driver.love, define `Foo = 3` in a definition define `Bar = Foo + 1` edit and redefine `Foo = 4` Before this commit, you'd get an error when you restart the app. Definitions used to be loaded in version order, and editing a definition would move it to the end of the load order, potentially after definitions using it. I mostly avoided this by keeping top-level definitions independent. It's fine to refer to any definition inside a function body, we only need to be careful with initializers for global variables which run immediately while loading. After this commit you can still end up in a weird state if you modify a definition that other later definitions use. In the above example, you will now see Foo = 4 and Bar = 4. But when you restart, Foo = 4 and Bar = 5. But that's no more confusing than Emacs's C-x C-e. It's still a good idea to keep top-level definitions order-independent. It's just confusing in a similar way to existing tools if you fail to do so. And your tools won't tend to break as badly. Why did I ever do my weird version history thing? I think it's my deep aversion to risking losing any data entered. (Even though the app currently will seem to lose data in those situations. You'd need to leave your tools to find the data.) Now I rely on driver.love's undo to avoid data loss, but once you shut it down you're stuck with what you have on disk. Or in git. I also wasn't aware for a long time of any primitives for deleting files. This might have colored my choices a lot.
2023-04-16 19:15:03 +01:00
## Hacking
2023-01-25 02:36:49 +00:00
To modify it live without restarting the app each time, download [the driver
2023-01-23 08:49:48 +00:00
app](https://git.sr.ht/~akkartik/driver.love). Here's an example session
2023-01-08 16:11:15 +00:00
using a fork of this repo:
2022-06-07 02:33:44 +01:00
2023-01-08 16:11:15 +00:00
![making changes without restarting the app](assets/2.gif)
2022-06-07 02:33:44 +01:00
If you run a .love file, your changes will go into the [save directory](https://love2d.org/wiki/love.filesystem.getSaveDirectory).
If you unzip the .love file into a new directory and run the directory
instead, your changes will go straight into the same directory.
new file-system format for freewheeling apps 1. No more version history, now we have just the contents of the current version. 2. Editing a definition no longer changes the order in which definitions load. This should make repos easier to browse, and more amenable to modify. You don't need driver.love anymore. And a stable order eliminates some gotchas. For example: using driver.love, define `Foo = 3` in a definition define `Bar = Foo + 1` edit and redefine `Foo = 4` Before this commit, you'd get an error when you restart the app. Definitions used to be loaded in version order, and editing a definition would move it to the end of the load order, potentially after definitions using it. I mostly avoided this by keeping top-level definitions independent. It's fine to refer to any definition inside a function body, we only need to be careful with initializers for global variables which run immediately while loading. After this commit you can still end up in a weird state if you modify a definition that other later definitions use. In the above example, you will now see Foo = 4 and Bar = 4. But when you restart, Foo = 4 and Bar = 5. But that's no more confusing than Emacs's C-x C-e. It's still a good idea to keep top-level definitions order-independent. It's just confusing in a similar way to existing tools if you fail to do so. And your tools won't tend to break as badly. Why did I ever do my weird version history thing? I think it's my deep aversion to risking losing any data entered. (Even though the app currently will seem to lose data in those situations. You'd need to leave your tools to find the data.) Now I rely on driver.love's undo to avoid data loss, but once you shut it down you're stuck with what you have on disk. Or in git. I also wasn't aware for a long time of any primitives for deleting files. This might have colored my choices a lot.
2023-04-16 19:15:03 +01:00
2022-06-07 02:33:44 +01:00
## Keyboard shortcuts
2023-01-08 16:11:15 +00:00
Up to you! But within the included editor widget if you use it:
2022-06-07 02:33:44 +01:00
* `ctrl+f` to find patterns within a file
* `ctrl+c` to copy, `ctrl+x` to cut, `ctrl+v` to paste
* `ctrl+z` to undo, `ctrl+y` to redo
* `ctrl+=` to zoom in, `ctrl+-` to zoom out, `ctrl+0` to reset zoom
2022-06-17 18:28:25 +01:00
* `alt+right`/`alt+left` to jump to the next/previous word, respectively
2022-11-19 08:11:39 +00:00
* mouse drag or `shift` + movement to select text, `ctrl+a` to select all
2022-06-07 02:33:44 +01:00
2022-08-14 17:17:53 +01:00
Exclusively tested so far with a US keyboard layout. If
2022-06-07 21:48:59 +01:00
you use a different layout, please let me know if things worked, or if you
2022-06-09 20:16:03 +01:00
found anything amiss: http://akkartik.name/contact
2022-06-07 21:48:59 +01:00
2022-05-30 01:03:01 +01:00
## Known issues
2022-05-21 18:36:27 +01:00
2023-01-08 16:11:15 +00:00
* Both freewheeling apps and the driver for them currently benefit from being
launched in terminal windows rather than by being clicked on in a desktop
2023-01-23 08:49:48 +00:00
OS. See [the driver app](https://git.sr.ht/~akkartik/driver.love/src/branch/main/README.md)
2023-01-08 16:11:15 +00:00
for details.
2022-05-18 06:05:00 +01:00
* No support yet for Unicode graphemes spanning multiple codepoints.
2022-05-21 18:36:27 +01:00
2022-07-08 22:16:48 +01:00
* No support yet for right-to-left languages.
2023-04-22 07:16:51 +01:00
* Undo/redo may be sluggish in editor windows containing large files. Large
files may grow sluggish in other ways.
2022-06-10 22:19:27 +01:00
* If you kill the process, say by force-quitting because things things get
sluggish, you can lose data.
* Can't scroll while selecting text with mouse.
2022-06-07 02:33:44 +01:00
## Mirrors and Forks
2023-01-19 04:30:37 +00:00
This repo is a fork of [lines.love](http://akkartik.name/lines.html), an
editor for plain text where you can also seamlessly insert line drawings.
2023-01-23 08:49:48 +00:00
Its immediate upstream is [text.love](https://git.sr.ht/~akkartik/text.love),
a version without support for line drawings. Updates to it can be downloaded
2023-01-09 05:52:30 +00:00
from the following mirrors:
2022-06-15 21:35:55 +01:00
2023-01-09 05:52:30 +00:00
* https://git.sr.ht/~akkartik/template-live-editor
2023-01-23 08:49:48 +00:00
* https://codeberg.org/akkartik/template-live-editor
2023-06-30 08:09:03 +01:00
* https://nest.pijul.com/akkartik/template-live-editor (using the Pijul version control system)
2022-07-02 23:23:44 +01:00
2022-08-14 17:17:53 +01:00
Further forks are encouraged. If you show me your fork, I'll link to it here.
2022-07-02 23:23:44 +01:00
2023-01-23 08:49:48 +00:00
* https://git.sr.ht/~akkartik/luaML.love - a "browser" for a Lua-based
2023-01-08 16:11:15 +00:00
markup language, loosely analogous to HTML except it's all Lua.
2023-01-19 04:36:45 +00:00
* https://git.sr.ht/~akkartik/bf.love - a toy environment for working with
[BF](https://en.wikipedia.org/wiki/Brainfuck) programs.
2023-01-20 07:33:25 +00:00
* https://git.sr.ht/~akkartik/broadsheet.love - a multi-column paginator that
uses all available width while remaining readable.
2023-10-21 06:34:07 +01:00
* https://git.sr.ht/~akkartik/crosstable.love - for all-play-all tournaments.
2023-01-08 16:11:15 +00:00
2022-06-07 02:33:44 +01:00
## Feedback
[Most appreciated.](http://akkartik.name/contact)