In-progress browser for a directory of text files
Go to file
Kartik K. Agaram fd5ca6f3f8 load in-memory data for a thread
Nothing displayed yet. I need to convert threads to Surface nodes.
2023-06-18 20:10:20 -07:00
assets
0000-freewheeling-start Merge template-live-editor 2023-04-16 11:30:56 -07:00
0001-on update one bit of documentation 2023-04-22 22:07:37 -07:00
0002-vx backport a few more changes from driver.love 2023-04-22 22:29:22 -07:00
0003-scale make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0004-vy backport a few more changes from driver.love 2023-04-22 22:29:22 -07:00
0005-Cursor_node make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0006-on.mouse_press load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0007-on_text make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0008-Viewport make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0009-on.code_change make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0010-initialize_editor new fork: pothi 2023-06-18 11:16:58 -07:00
0011-box_height backport a few more changes from driver.love 2023-04-22 22:29:22 -07:00
0012-on.initialize load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0013-font make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0014-y_of_schema1 make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0015-line_height make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0016-schema1_of_y make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0017-on.mouse_release get rid of definitions (mostly) 2023-06-18 19:12:48 -07:00
0018-on.update get rid of definitions (mostly) 2023-06-18 19:12:48 -07:00
0019-B make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0021-compute_layout get rid of animation and editor movement 2023-06-18 13:04:18 -07:00
0022-on.text_input get rid of manifests 2023-06-18 19:08:29 -07:00
0023-on.keychord_press load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0024-copy_shape make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0025-add_thick_line make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0026-on.draw load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0027-Surface indent 2023-06-10 12:18:29 -07:00
0028-A bugfix: size text/box when changing zoom 2023-04-22 22:27:30 -07:00
0030-update_editor_box new fork: pothi 2023-06-18 11:16:58 -07:00
0032-Definitions make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0035-mouse_cursor make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0036-Mouse_cursor make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0037-set_mouse_cursor make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0040-Menu_background_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0041-Menu_border_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0042-Menu_command_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0043-Menu_highlight_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0044-add_hotkey_to_menu make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0052-draw_cursor make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0061-on.key_release get rid of animation and editor movement 2023-06-18 13:04:18 -07:00
0062-on.save_settings new fork: pothi 2023-06-18 11:16:58 -07:00
0072-Spawn_point make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0077-new_definition new fork: pothi 2023-06-18 11:16:58 -07:00
0081-draw_menu_bar load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0096-iscale make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0097-sy make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0098-sx make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0106-on.load_settings new fork: pothi 2023-06-18 11:16:58 -07:00
0110-Border_color new fork: pothi 2023-06-18 11:16:58 -07:00
0111-Files load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0112-Global_state load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0113-draw_surface load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0114-draw_file_picker load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0115-update_font_size load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0116-mouse_press_on_surface load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0117-open_thread load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0118-load_subtree load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0119-load_metadata load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0120-initialize_item load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0121-full_path load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0122-metadata_file load in-memory data for a thread 2023-06-18 20:10:20 -07:00
0123-save_dir_path load in-memory data for a thread 2023-06-18 20:10:20 -07:00
LICENSE.txt
Manual_tests.md bugfix: delete definition 2023-06-10 12:49:06 -07:00
MemoryReferenceInfo.lua.0
MemoryReferenceInfo.lua.unused
README.md Merge luaML.love 2023-05-30 01:17:26 -07:00
app.lua Merge luaML.love 2023-06-05 22:43:58 -07:00
button.lua
default_map
driver.lua Merge luaML.love 2023-02-04 21:21:56 -08:00
edit.lua get rid of some code editor features 2023-06-18 11:50:51 -07:00
file.lua bugfix: drawings in source editor 2023-05-30 00:02:09 -07:00
json.lua
keychord.lua rename modifier_down to key_down 2023-06-05 22:21:04 -07:00
live.lua new fork: pothi 2023-06-18 11:16:58 -07:00
main.lua get rid of some code editor features 2023-06-18 11:50:51 -07:00
reference.md Merge luaML.love 2023-06-07 22:43:21 -07:00
search.lua Merge luaML.love 2023-05-13 17:40:20 -07:00
select.lua Merge lines.love 2023-06-04 15:11:24 -07:00
test.lua
text.lua get rid of some code editor features 2023-06-18 11:50:51 -07:00
text_tests desired behavior now looks good 2023-06-02 07:46:45 -07:00
text_tests.lua Merge luaML.love 2023-06-04 15:48:20 -07:00
undo.lua Merge lines.love 2023-04-02 09:22:32 -07:00

README.md

Thin programming environment for making edits to live, "freewheeling" LÖVE apps

Use this app to communicate over a back-channel with LÖVE apps that follow a certain protocol:

Communication happens over temporary files in the file system that should live in an internal directory, but might end up in your home directory. Using these files, driver.love can make changes to these apps without needing to restart them.

demo

driver.love is a fork of lines.love, 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.

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.

Run this app from the terminal, passing its directory to LÖVE

You must have a "freewheeling" client app running that can be communicated with and that you're trying to modify; otherwise driver.love will hang until it finds one, and might need to be force-quit. (Also, bad things will happen if you have more than a single client app running. Or if you close one app and open another without restarting the driver. Just always open the app and then the driver. If you close the app, close the driver.)

So download and run say broadsheet.love in a separate terminal.

Now try pressing ctrl+l in this driver app. Select on by some combination of typing letters and moving the arrow keys. It provides a useful orientation of available hooks when programming live, and also mentions an important gotcha.

Each definition lives in a blue box. You have to follow a specific Lua syntax where the name of the definition comes first: foo = function(...) ... end rather than function foo(...) ... end. The driver treats the first word in a definition is its name.

To pan, drag the surface around. To increase/decrease zoom, press ctrl+=, ctrl+- respectively. To reset zoom press ctrl+0.

To move a definition, drag the bar on the top-left.

Functions that start with test_ are tests, and run any time you hit f4. The driver will highlight them in green or red when they fail.

Hacking

To edit formatting you'll need to modify the code for the app. To do this live without restarting the app each time, download the driver app. Here's an example session using a fork of this repo:

making changes without restarting the app

Some reference documentation on how to create your own apps.

To publish your changes:

  • delete all files with a numeric prefix from the repo, and then
  • move all files with a numeric prefix from the save directory to the repo.

Keyboard shortcuts

At any time:

  • f4 to send current buffer to the client app. (Run only one such "freewheeling" app at a time.)
  • ctrl+l to browse a list of definitions within the app that are available to edit. (Not everything will be.)
  • ctrl+d to delete a definition.
  • ctrl+g to zoom out to see everything, or zoom back in to where you were.

When some definition has focus (a cursor):

  • 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
  • ctrl+right/ctrl+left to jump to the next/previous word, respectively
  • mouse drag or shift + movement to select text, ctrl+a to select all

When no definition has focus:

  • arrow keys pan the surface
  • shift+arrow keys pan faster
    • pagedown and pageup are aliases for shift+down and shift+up respectively

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

  • Bad things will happen if you have more than a single client app running. Or if you close one app and open another without restarting the driver. Just always open the app and then the driver. If you close the app, close the driver.

  • You have to follow a specific Lua syntax where the name of the definition comes first: foo = function(...) ... end rather than function foo(...) ... end. The driver treats the first word in a definition is its name. For similar reasons, a definition can't start with a comment. Put comments within functions or after them.

  • Don't give up your other tools just yet. It's easy to make a mistake that the app doesn't recover from when you fix it. Try restarting the app, and if it still doesn't work, perhaps you need to fix the initial load. This isn't yet a tool you can keep open for months on end. (And I'm ambivalent about making it such a tool since your programs might stop working for others.)

  • I still see driver and the app being driven occasionally crash. When I do I try to make things more robust. If you do you'll quite possibly crash again if you try to restart. In such a situation you'll have to bump down to editing the underlying version files by other means. See representation.md for details of the underlying representation on disk.

  • Given the above issues, both this driver and its client freewheeling app benefit from being launched in terminal windows rather than by being clicked on in a desktop OS.

  • No support yet for Unicode graphemes spanning multiple codepoints.

  • No support yet for right-to-left languages.

  • Undo/redo may be sluggish in editor windows containing large files. Large files may grow sluggish in other ways.

  • 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.

  • No scrollbars yet. That stuff is hard.

Mirrors and Forks

This repo is a fork of lines.love, an editor for plain text where you can also seamlessly insert line drawings. Its immediate upstream is luaML.love, a box model for a Lua-based markup language that models an infinite pannable, zoomable 2D surface. Updates to it can be downloaded from the following mirrors:

Further forks are encouraged. If you show me your fork, I'll link to it here.

Feedback

Most appreciated.