aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 11:54:31 +0100
committereunhhu <[email protected]>2026-09-26 11:54:31 +0100
commit8e2b3ffadcf83dba74d58dbf9ee2c57cef5f1ad5 (patch)
treec99c2c0066af352e9f7487763cf016740467f917 /src/screen.c
parent932df09ea211a83a24210d821dc3d0093ed73561 (diff)
downloadvega-8e2b3ffadcf83dba74d58dbf9ee2c57cef5f1ad5.tar.gz
vega-8e2b3ffadcf83dba74d58dbf9ee2c57cef5f1ad5.zip
Swap a running app's module: --watch and the swap command
vega tui|web MODULE --watch replaces the running app's module when its file is written again (aup watch writes it); states keep their values by name through pure_app_replace and every web page hears of it. The file is compared by the digest of its bytes, at most five times a second, so a module of the same size written within the same second is not missed; a module that does not load leaves the app as it was and is not tried again. Modules alternate between two slots so a failed load never touches the running one. Scripts get swap MODULE; whether a module runs frames is now a property of the screen.
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c
index 26b9fb0..56c2cf9 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -20,6 +20,7 @@ void vega_screen(VegaScreen *screen, const PureModule *m) {
screen->prompt = -1;
for (uint32_t i = 0; i < m->inputs && screen->prompt < 0; ++i)
if (m->input[i].kind == PURE_KIND_TEXT) screen->prompt = (int)i;
+ for (uint32_t h = 0; h < m->handlers; ++h) screen->ticks = screen->ticks || m->handler[h].event == 0;
/* A <table>_focus view belongs to its table, not to the fields. */
bool focus_view[PURE_MODULE_VIEWS] = {false};
for (uint32_t i = 0; i < m->views; ++i) {