Kartik K. Agaram b2553c8046 | ||
---|---|---|
assets | ||
0000-freewheeling-start | ||
0001-on | ||
0002-Debug_animations_in_progress | ||
0002-vx | ||
0003-refresh_debug_animations | ||
0003-scale | ||
0004-on.update | ||
0004-vy | ||
0005-Cursor_node | ||
0005-animate | ||
0006-loiter | ||
0006-on.mouse_press | ||
0007-on_text | ||
0007-save_callstack | ||
0008-Debug_animation_period | ||
0008-Viewport | ||
0009-on.code_change | ||
0010-initialize_editor | ||
0011-box_height | ||
0012-on.initialize | ||
0013-font | ||
0014-y_of_schema1 | ||
0015-line_height | ||
0016-schema1_of_y | ||
0017-on.mouse_release | ||
0018-on.update | ||
0019-B | ||
0021-compute_layout | ||
0022-on.text_input | ||
0023-on.keychord_press | ||
0024-copy_shape | ||
0025-add_thick_line | ||
0026-on.draw | ||
0027-Surface | ||
0028-A | ||
0030-update_editor_box | ||
0031-Manifest_navigator | ||
0031-cols | ||
0032-Definitions | ||
0032-rows | ||
0033-maybe_update_key_in_definitions | ||
0033-test_y_of_schema1 | ||
0034-dump_state | ||
0034-on_handle | ||
0035-mouse_cursor | ||
0035-pan_viewport_to_contain_cursor | ||
0036-Mouse_cursor | ||
0037-set_mouse_cursor | ||
0038-order_of_magnitude | ||
0039-approximate | ||
0040-Menu_background_color | ||
0041-Menu_border_color | ||
0042-Menu_command_color | ||
0043-Menu_highlight_color | ||
0044-add_hotkey_to_menu | ||
0045-manifest_navigator_up | ||
0046-move_candidate_to_front_of_manifest | ||
0047-text_input_on_manifest_navigator | ||
0048-manifest_navigator_down | ||
0049-manifest_coord | ||
0050-manifest_index | ||
0051-manifest_navigator_candidates | ||
0052-draw_cursor | ||
0053-add_def_to_menu | ||
0054-Ticks_font | ||
0055-load_from_iterator | ||
0056-delete_definition | ||
0057-num_lines_for_manifest_navigator | ||
0058-draw_manifest_navigator | ||
0059-table_and_array_both_empty | ||
0060-load_manifest | ||
0061-on.key_release | ||
0062-on.save_settings | ||
0063-keychord_press_on_manifest_navigator | ||
0064-get_manifest | ||
0065-Manifest | ||
0066-reset_manifest_navigator | ||
0067-initialize_manifest_navigator | ||
0068-wait_for_response | ||
0069-get_definition_from_app | ||
0070-draw_run_time_error | ||
0071-surface_bounds | ||
0073-from_viewport | ||
0074-Num_animation_frames | ||
0075-Animating | ||
0076-interpolate_viewport | ||
0077-new_definition | ||
0078-Definition_background_color | ||
0079-load_definition | ||
0080-Test_definition_background_color | ||
0081-draw_menu_bar | ||
0082-Save_viewport | ||
0083-copy_viewport | ||
0084-Zoomed_out | ||
0085-zoom_out | ||
0086-snapshot_canvas | ||
0087-animate_next | ||
0088-animate_next_frame | ||
0089-zoom_in | ||
0090-undo_zoom_out | ||
0091-Failing_test_definition_background_color | ||
0092-draw_load_time_error | ||
0093-draw_test_failure_indicator | ||
0094-get_default_map | ||
0095-on.code_submit | ||
0096-iscale | ||
0097-sy | ||
0098-sx | ||
0099-test_approximate_up | ||
0100-approximate_up | ||
0101-draw_ticks | ||
0102-tick_spec | ||
0103-survey_animation | ||
0104-definition_background_color | ||
0105-get_multiple_definitions_from_app | ||
0106-on.load_settings | ||
0107-A1 | ||
0108-Global_viewport | ||
0109-initialize_global_viewport | ||
0110-on.mouse_wheel_move | ||
0111-Settings | ||
0112-submit_definition | ||
0115-round | ||
0116-spawn_point | ||
0119-overlapping_areas | ||
0120-overlaps_any_definition | ||
0121-draw_debug | ||
0122-Show_debug | ||
0124-draw_debug_definitions | ||
0125-Spawn_candidates | ||
0126-test_overlapping_areas | ||
0127-collide | ||
0128-move_others | ||
0129-prepare_to_move | ||
0130-move | ||
0131-sign | ||
0132-on.resize | ||
0133-dist | ||
0134-draw_move_node_shadow | ||
0135-populate_collision_data | ||
LICENSE.txt | ||
Manual_tests.md | ||
MemoryReferenceInfo.lua.0 | ||
MemoryReferenceInfo.lua.unused | ||
README.md | ||
app.lua | ||
button.lua | ||
colorize.lua | ||
default_map | ||
driver.lua | ||
edit.lua | ||
file.lua | ||
json.lua | ||
keychord.lua | ||
live.lua | ||
main.lua | ||
nativefs.lua | ||
reference.md | ||
search.lua | ||
select.lua | ||
test.lua | ||
text.lua | ||
text_tests | ||
text_tests.lua | ||
undo.lua |
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:
- https://git.sr.ht/~akkartik/night.love -- sample app showing a slowly revolving night sky
- https://git.sr.ht/~akkartik/template-live -- template for new apps
- https://git.sr.ht/~akkartik/broadsheet.love -- multi-column text reader
- https://git.sr.ht/~akkartik/mastodon-unfurl.love -- mastodon thread visualizer
- https://git.sr.ht/~akkartik/spell-cards.love -- flash cards for drilling spelling
- https://git.sr.ht/~akkartik/bf.love -- BF programming environment
- https://git.sr.ht/~akkartik/luaML.love -- simple web-browser-like box model implementation
- https://git.sr.ht/~akkartik/template-live-editor -- template for new apps that need editor widgets
- ...
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.
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.
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:
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 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 zoomctrl+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 fasterpagedown
andpageup
are aliases forshift+down
andshift+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 thanfunction 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.
-
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:
- https://git.sr.ht/~akkartik/driver.love
- https://tildegit.org/akkartik/driver.love
- https://git.merveilles.town/akkartik/driver.love
- https://codeberg.org/akkartik/driver.love
- https://nest.pijul.com/akkartik/driver.love (using the Pijul version control system)
Further forks are encouraged. If you show me your fork, I'll link to it here.
- https://git.sr.ht/~akkartik/pothi.love - a browser for a directory of files
Feedback
Most appreciated. Messages, PRs, patches, forks, it's all good.