aboutsummaryrefslogtreecommitdiff
path: root/src/lib/std.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 10:42:28 +0000
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 10:42:28 +0000
commitea052eab91b304459ddf64281fc93fc152597412 (patch)
tree8dcd378d6634626dd2529c2aef684890999de963 /src/lib/std.zc
parenttodo: the spec verifier restarted from the first agent's partial work (diff)
parentfix std hover, full capture terminator, bare static calls, void main in run-o... (diff)
Merge four small fixes: std hovers, capture terminator, bare static calls, void main; todo updated
Diffstat (limited to 'src/lib/std.zc')
-rw-r--r--src/lib/std.zc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/std.zc b/src/lib/std.zc
index 33ab1e9..772b887 100644
--- a/src/lib/std.zc
+++ b/src/lib/std.zc
@@ -73,7 +73,8 @@ int libinit() {
// rt.put_s("hello world!"); // nothing on the terminal
// std.capture.end(buf);
// rt.put_s(buf); // hello world!
-// the buffer holds 256 characters, and output past that is dropped.
+// the buffer holds 256 characters, and output past that is dropped. it has one
+// more word for the 0 that end() writes, so a full capture is still a string.
// one capture at a time, and the buffer belongs to whoever holds it.
struct capture {
// starts a capture: output goes into a new buffer instead of the terminal.
@@ -81,7 +82,7 @@ struct capture {
static char* start() {
int cap = 256;
rt.outmode = 2; rt.outn = 0; rt.outcap = cap;
- rt.outbuf = rt.new(cap);
+ rt.outbuf = rt.new(cap + 1);
return rt.outbuf;
}
// stops the capture and ends the buffer with a 0.