Programming environment for editing various of my live apps without restarting them.
Go to file
Kartik K. Agaram 83b8a4c76a Merge luaML.love 2024-06-16 06:43:29 -07:00
assets improve driver Readme 2023-12-13 20:07:55 -08:00
0000-freewheeling-start Merge template-live-editor 2023-04-16 11:30:56 -07:00
0001-on Merge luaML.love 2023-12-26 09:36:41 -08:00
0002-Debug_animations_in_progress debug animations 2023-11-11 10:00:54 -08:00
0002-vx undo 2 most recent commits 2023-10-25 09:29:22 -07:00
0003-refresh_debug_animations debug animations 2023-11-11 10:00:54 -08:00
0003-scale undo 2 most recent commits 2023-10-25 09:29:22 -07:00
0004-on.update debug animations 2023-11-11 10:00:54 -08:00
0004-vy undo 2 most recent commits 2023-10-25 09:29:22 -07:00
0005-Cursor_node make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0005-animate debug animations 2023-11-11 10:00:54 -08:00
0006-loiter debug animations 2023-11-11 10:00:54 -08:00
0006-on.mouse_press better experience of moving a node around 2023-12-21 08:10:05 -08:00
0007-on_text make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0007-save_callstack debug animations 2023-11-11 10:00:54 -08:00
0008-Debug_animation_period debug animations 2023-11-11 10:00:54 -08:00
0008-Viewport document a desirable invariant 2024-06-16 05:15:01 -07:00
0009-on.code_change make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0010-initialize_editor Merge luaML.love 2024-01-15 03:51:16 -08:00
0011-box_height snapshot: commit 0ca5bb0e8d, take 2 2023-10-25 09:30:50 -07:00
0012-on.initialize bugfix: keep Viewport dimensions more up to date 2023-12-17 13:16:08 -08:00
0013-font make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0014-y_of_schema1 bugfix: pin down schema1->y behavior 2023-10-25 00:11:58 -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 better experience of moving a node around 2023-12-21 08:10:05 -08:00
0018-on.update better experience of moving a node around 2023-12-21 08:10:05 -08:00
0019-B Merge luaML.love 2023-10-27 18:23:24 -07:00
0021-compute_layout Merge luaML.love 2023-10-27 18:23:24 -07:00
0022-on.text_input Merge luaML.love 2023-10-28 01:21:50 -07:00
0023-on.keychord_press make space if needed when adding lines to a definition 2023-12-21 20:50:31 -08: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 don't show padding when collisions won't happen 2023-12-22 18:48:40 -08:00
0027-Surface undo 2 most recent commits 2023-10-25 09:29:22 -07:00
0028-A Merge luaML.love 2023-10-27 18:23:24 -07:00
0030-update_editor_box Merge luaML.love 2024-01-15 03:51:16 -08:00
0031-Manifest_navigator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0031-cols some helpers 2023-06-20 17:34:03 -07:00
0032-Definitions make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0032-rows some helpers 2023-06-20 17:34:03 -07:00
0033-maybe_update_key_in_definitions bugfix: keep definition keys up to date 2023-10-30 22:35:58 -07:00
0033-test_y_of_schema1 bugfix: pin down schema1->y behavior 2023-10-25 00:11:58 -07:00
0034-dump_state snapshot: insight 2023-10-25 16:14:08 -07:00
0034-on_handle 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
0035-pan_viewport_to_contain_cursor clean up debug prints 2023-10-27 18:26:29 -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
0038-order_of_magnitude make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0039-approximate 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
0045-manifest_navigator_up make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0046-move_candidate_to_front_of_manifest make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0047-text_input_on_manifest_navigator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0048-manifest_navigator_down make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0049-manifest_coord make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0050-manifest_index make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0051-manifest_navigator_candidates 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
0053-add_def_to_menu merge bugfix 2023-10-16 23:52:33 -07:00
0054-Ticks_font make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0055-load_from_iterator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0056-delete_definition bugfix: delete definition 2023-06-10 12:49:06 -07:00
0057-num_lines_for_manifest_navigator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0058-draw_manifest_navigator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0059-table_and_array_both_empty make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0060-load_manifest make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0061-on.key_release make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0062-on.save_settings make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0063-keychord_press_on_manifest_navigator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0064-get_manifest make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0065-Manifest make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0066-reset_manifest_navigator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0067-initialize_manifest_navigator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0068-wait_for_response make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0069-get_definition_from_app make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0070-draw_run_time_error make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0071-surface_bounds make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0073-from_viewport make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0074-Num_animation_frames make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0075-Animating make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0076-interpolate_viewport make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0077-new_definition spawn nodes randomly within the current viewport 2023-11-12 10:38:42 -08:00
0078-Definition_background_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0079-load_definition bugfix: pan to existing definitions 2023-11-16 08:40:50 -08:00
0080-Test_definition_background_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0081-draw_menu_bar highlight zoom out hotkey 2023-06-10 13:11:16 -07:00
0082-Save_viewport make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0083-copy_viewport make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0084-Zoomed_out make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0085-zoom_out keep surface bounds updated when zooming out 2023-06-15 18:41:16 -07:00
0086-snapshot_canvas make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0087-animate_next make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0088-animate_next_frame make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0089-zoom_in make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0090-undo_zoom_out make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0091-Failing_test_definition_background_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0092-draw_load_time_error make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0093-draw_test_failure_indicator make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0094-get_default_map make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0095-on.code_submit make order of files consistent with upstream 2023-04-22 18:50:18 -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
0099-test_approximate_up make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0100-approximate_up make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0101-draw_ticks make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0102-tick_spec make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0103-survey_animation make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0104-definition_background_color make order of files consistent with upstream 2023-04-22 18:50:18 -07:00
0105-get_multiple_definitions_from_app bugfix: consistently map definitions to names 2023-10-15 16:03:43 -07:00
0106-on.load_settings Merge luaML.love 2023-07-10 19:50:54 -07:00
0107-A1 Merge luaML.love 2023-10-21 10:12:09 -07:00
0108-Global_viewport keep surface bounds updated when zooming out 2023-06-15 18:41:16 -07:00
0109-initialize_global_viewport keep surface bounds updated when zooming out 2023-06-15 18:41:16 -07:00
0110-on.mouse_wheel_move support mouse wheel 2023-06-18 22:18:53 -07:00
0111-Settings Merge luaML.love 2023-07-10 19:50:54 -07:00
0112-submit_definition hoist f4-handling out of editor substrate 2023-07-23 18:56:53 -07:00
0115-round position nodes on discrete multiples of 100 2023-11-12 09:49:25 -08:00
0116-spawn_point remove stale correction code 2023-12-10 10:48:49 -08:00
0119-overlapping_areas greatly simplify overlap detection 2023-12-10 10:31:45 -08:00
0120-overlaps_any_definition spawning tries 10 times to avoid overlap 2023-11-26 22:55:54 -08:00
0121-draw_debug spawning tries 10 times to avoid overlap 2023-11-26 22:55:54 -08:00
0122-Show_debug spawning tries 10 times to avoid overlap 2023-11-26 22:55:54 -08:00
0124-draw_debug_definitions spawning tries 10 times to avoid overlap 2023-11-26 22:55:54 -08:00
0125-Spawn_candidates spawning tries 10 times to avoid overlap 2023-11-26 22:55:54 -08:00
0126-test_overlapping_areas spawning tries 10 times to avoid overlap 2023-11-26 22:55:54 -08:00
0127-collide add some padding, and avoid infinite recursion 2023-12-12 21:41:49 -08:00
0128-move_others add some padding, and avoid infinite recursion 2023-12-12 21:41:49 -08:00
0129-prepare_to_move make space if needed when adding lines to a definition 2023-12-21 20:50:31 -08:00
0130-move nudge colliding definitions aside when moving 2023-12-12 19:57:00 -08:00
0131-sign nudge colliding definitions aside when moving 2023-12-12 19:57:00 -08:00
0132-on.resize typo X-( 2023-12-17 14:32:35 -08:00
0133-dist better experience of moving a node around 2023-12-21 08:10:05 -08:00
0134-draw_move_node_shadow don't show padding when collisions won't happen 2023-12-22 18:48:40 -08:00
0135-populate_collision_data make space if needed when adding lines to a definition 2023-12-21 20:50:31 -08:00
LICENSE.txt add a license 2022-05-16 18:51:28 -07:00
Manual_tests.md Merge luaML.love 2023-12-07 01:28:07 -08:00
MemoryReferenceInfo.lua.0 remove some memory leaks from rendered fragments 2022-06-10 11:16:41 -07:00
MemoryReferenceInfo.lua.unused clean up memory leak experiments 2022-06-10 13:46:59 -07:00
README.md fix a crash involving mouse and drawings 2024-06-09 13:17:55 -07:00
app.lua Merge luaML.love 2024-06-11 13:31:15 -07:00
button.lua bugfix :( 2023-12-18 21:39:01 -08:00
colorize.lua Merge luaML.love 2023-06-17 10:56:06 -07:00
default_map suggest a default layout for freewheeling apps 2023-11-11 10:31:25 -08:00
driver.lua merge bugfix 2023-12-17 00:17:55 -08:00
edit.lua Merge luaML.love 2024-06-16 06:43:29 -07:00
file.lua audit all asserts 2023-11-18 11:32:01 -08:00
json.lua forgot to add json.lua 2022-05-15 14:36:25 -07:00
keychord.lua support for num pad 2023-07-07 18:40:12 -07:00
live.lua Merge luaML.love 2023-12-15 15:33:45 -08:00
main.lua Merge luaML.love 2024-05-20 00:32:19 -07:00
nativefs.lua cleaner API for file-system access 2023-08-30 19:04:06 -07:00
reference.md Merge luaML.love 2024-06-16 06:43:29 -07:00
search.lua Merge text0 2024-06-11 12:54:49 -07:00
select.lua Merge lines.love 2024-06-11 12:13:18 -07:00
test.lua show another detail on test failure 2023-01-20 21:48:49 -08:00
text.lua Merge luaML.love 2024-06-11 13:31:15 -07:00
text_tests bugfix: clear selection when clicking above or below lines 2023-09-20 13:39:29 -07:00
text_tests.lua Merge luaML.love 2024-06-11 13:31:15 -07:00
undo.lua fix a couple of asserts missed in the recent audit 2023-12-09 09:22:45 -08: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

This repo is an example of a Freewheeling App, designed above all to be easy to run, easy to modify and easy to share.

Getting started

Install LÖVE. It's just a 5MB download, open-source and extremely well-behaved.

Run the app using 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

While this app is used to help modify other apps, it is also itself a freewheeling app you can modify with another copy of itself with just a few changes. On a unix-like platform, run the following commands to turn this repo into a "meta-driver":

sed -i -e 's/app_driver/driver_driver2/g' -e 's/driver_app/driver2_driver/' driver.lua
sed -i -e 's/driver2_driver/driver3_driver2/g' -e 's/driver_driver2/driver2_driver3/' live.lua

Now you can modify the code for the driver without restarting it each time. Run some app, then run this driver, then run the meta-driver. Here's an example session:

making changes without restarting the app

Some reference documentation on how to create your own apps.

If you run off of this repo, changes to the driver will get saved right here. If you first create a .love file, your changes will go into the save directory.

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.

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