Codebergdnkl
foot
master
1#pragma once
3#include <stddef.h>
4#include "debug.h"
5#include "terminal.h"
7struct grid *grid_snapshot(const struct grid *grid);
8void grid_free(struct grid *grid);
10void grid_swap_row(struct grid *grid, int row_a, int row_b);
11struct row *grid_row_alloc(int cols, bool initialize);
12void grid_row_free(struct row *row);
14void grid_resize_without_reflow(
15 struct grid *grid, int new_rows, int new_cols,
16 int old_screen_rows, int new_screen_rows);
18void grid_resize_and_reflow(
19 struct grid *grid, const struct terminal *term, int new_rows, int new_cols,
20 int old_screen_rows, int new_screen_rows,
21 size_t tracking_points_count,
22 struct coord *const _tracking_points[static tracking_points_count]);
24/* Convert row numbers between scrollback-relative and absolute coordinates */
25int grid_row_abs_to_sb(const struct grid *grid, int screen_rows, int abs_row);
26int grid_row_sb_to_abs(const struct grid *grid, int screen_rows, int sb_rel_row);
28int grid_sb_start_ignore_uninitialized(const struct grid *grid, int screen_rows);
29int grid_row_abs_to_sb_precalc_sb_start(
30 const struct grid *grid, int sb_start, int abs_row);
31int grid_row_sb_to_abs_precalc_sb_start(
32 const struct grid *grid, int sb_start, int sb_rel_row);
34static inline int
35grid_row_absolute(const struct grid *grid, int row_no)
36{
37 return (grid->offset + row_no) & (grid->num_rows - 1);
38}
40static inline int
41grid_row_absolute_in_view(const struct grid *grid, int row_no)
42{
43 return (grid->view + row_no) & (grid->num_rows - 1);
44}
46static inline struct row *
47_grid_row_maybe_alloc(struct grid *grid, int row_no, bool alloc_if_null)
48{
49 xassert(grid->offset >= 0);
51 int real_row = grid_row_absolute(grid, row_no);
52 struct row *row = grid->rows[real_row];
54 if (row == NULL && alloc_if_null) {
55 row = grid_row_alloc(grid->num_cols, false);
56 grid->rows[real_row] = row;
57 }
59 xassert(row != NULL);
60 return row;
61}
63static inline struct row *
64grid_row(struct grid *grid, int row_no)
65{
66 return _grid_row_maybe_alloc(grid, row_no, false);
67}
69static inline struct row *
70grid_row_and_alloc(struct grid *grid, int row_no)
71{
72 return _grid_row_maybe_alloc(grid, row_no, true);
73}
75static inline struct row *
76grid_row_in_view(struct grid *grid, int row_no)
77{
78 xassert(grid->view >= 0);
80 int real_row = grid_row_absolute_in_view(grid, row_no);
81 struct row *row = grid->rows[real_row];
83 xassert(row != NULL);
84 return row;
85}
87void grid_row_uri_range_put(
88 struct row *row, int col, const char *uri, uint64_t id);
89void grid_row_uri_range_erase(struct row *row, int start, int end);
91void grid_row_underline_range_put(
92 struct row *row, int col, struct underline_range_data data);
93void grid_row_underline_range_erase(struct row *row, int start, int end);
95static inline void
96grid_row_uri_range_destroy(struct row_range *range)
97{
98 free(range->uri.uri);
99}
101static inline void
102grid_row_underline_range_destroy(struct row_range *range)
103{
104}
106static inline void
107grid_row_range_destroy(struct row_range *range, enum row_range_type type)
108{
109 switch (type) {
110 case ROW_RANGE_URI: grid_row_uri_range_destroy(range); break;
111 case ROW_RANGE_UNDERLINE: grid_row_underline_range_destroy(range); break;
112 }
113}
115static inline void
116grid_row_ranges_destroy(struct row_ranges *ranges, enum row_range_type type)
117{
118 for (int i = 0; i < ranges->count; i++) {
119 grid_row_range_destroy(&ranges->v[i], type);
120 }
121}
123static inline void
124grid_row_reset_extra(struct row *row)
125{
126 struct row_data *extra = row->extra;
128 if (likely(extra == NULL))
129 return;
131 grid_row_ranges_destroy(&extra->uri_ranges, ROW_RANGE_URI);
132 grid_row_ranges_destroy(&extra->underline_ranges, ROW_RANGE_UNDERLINE);
133 free(extra->uri_ranges.v);
134 free(extra->underline_ranges.v);
136 free(extra);
137 row->extra = NULL;
138}
Diagnostics5 git calls · 978 ms
CallStatusSizeTime0978 ms
discover200178 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=178 git.server.agent=git/2.56.1-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=178 git.pkt.payload.max=35
ls-refs20010 KiB488 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=416 git.response.bytes=10322 git.response.cache=EXPIRED git.response.duration_ms=488 git.protocol.version=2 git.pkt.frames=108 git.pkt.data=107 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=10322 git.pkt.payload.max=106 git.ls_refs.count=107 git.ls_refs.head=refs/heads/master
fetchtree:0 · deepen 102009.3 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=9489 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=9489 git.pkt.payload.max=9389 git.sideband.band1.bytes=9389 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=10 git.pack.bytes=9389 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=de930681b6073ba5b599a0f956bfbd114762ad5a git.pack.full=10Open pack map
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=8830 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=8830 git.pkt.payload.max=8730 git.sideband.band1.bytes=8730 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=14 git.pack.bytes=8730 git.fetch.wide.objects=14 git.fetch.wide.extra_bytes=9909 git.fetch.wide.blobs=0
fetch2001.0 KiB487 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=487 git.response.bytes=1060 git.response.cache=MISS git.response.duration_ms=487 git.fetch.wants=71bdc29e82a343635ebeff629a97e32617fe323d git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1060 git.pkt.payload.max=1033 git.sideband.band1.bytes=1033 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://codeberg.org/dnkl/foot
- Ref
- refs/heads/master
- Commit
- c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
- cf-ray
- a5e25cf20802224d
- Request
- f68af194…
- Protocol
- v2 · sha1
- Agent
- git/2.56.1-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format