aboutsummaryrefslogtreecommitdiffstats
path: root/surfaces
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-30 16:33:21 +0100
committereunhhu <[email protected]>2026-09-30 16:33:27 +0100
commit49e0df31289956aa3fd627f851f8fb2b3e08aa13 (patch)
tree44d06de75d04078f82f74cf883551c1c780ea5b7 /surfaces
parent72ecae6b6eb1365e722bd6d45acae8a5ccb74b23 (diff)
downloadvega-49e0df31289956aa3fd627f851f8fb2b3e08aa13.tar.gz
vega-49e0df31289956aa3fd627f851f8fb2b3e08aa13.zip
Show an i64 with every digit on every surface
vega_text reads an i64 view or column as an integer and prints all of its digits, so an ID past 2^53 shows as it is on the CLI, the TUI, speech and the web surface, where a number would round.
Diffstat (limited to 'surfaces')
-rw-r--r--surfaces/screen.c7
-rw-r--r--surfaces/vega.h5
2 files changed, 10 insertions, 2 deletions
diff --git a/surfaces/screen.c b/surfaces/screen.c
index 51181a5..ed06c9d 100644
--- a/surfaces/screen.c
+++ b/surfaces/screen.c
@@ -1,6 +1,7 @@
#define _POSIX_C_SOURCE 200809L
#include "vega.h"
#include "module-text.h"
+#include <inttypes.h>
#include <math.h>
#include <string.h>
#include <time.h>
@@ -163,6 +164,12 @@ bool vega_text(PureApp *app, uint32_t view, size_t row, char out[VEGA_TEXT], siz
++evaluations;
*length = 0;
out[0] = 0;
+ if (m->view_type[view] == PURE_VIEW_I64) { /* every digit */
+ int64_t value;
+ if (!(column ? pure_app_cell_i64(app, view, row, &value) : pure_app_view_i64(app, view, &value))) return false;
+ *length = (size_t)snprintf(out, VEGA_TEXT, "%" PRId64, value);
+ return true;
+ }
if (m->view_type[view] == PURE_VIEW_NUM || m->view_type[view] == PURE_VIEW_BOOL) {
double value;
if (!(column ? pure_app_cell(app, view, row, &value) : pure_app_view(app, view, &value))) return false;
diff --git a/surfaces/vega.h b/surfaces/vega.h
index c172d31..a800835 100644
--- a/surfaces/vega.h
+++ b/surfaces/vega.h
@@ -59,8 +59,9 @@ long vega_timers_run(VegaTimers *, PureApp *, double clock, bool *ticked);
* returns how many there were. */
unsigned vega_check(const PureModule *, void (*report)(void *, const char *name, const char *message), void *context);
-/* A view (row ignored) or a column at a row as text; numbers in Pure's
- * shortest form. false when it has no value (for example a missing item). */
+/* A view (row ignored) or a column at a row as text: numbers in Pure's
+ * shortest form, bools as true or false, i64s with every digit. false when
+ * it has no value (for example a missing item). */
bool vega_text(PureApp *, uint32_t view, size_t row, char out[VEGA_TEXT], size_t *length);
bool vega_number(PureApp *, uint32_t view, size_t row, double *out);
size_t vega_rows(PureApp *, const VegaPart *);