summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 835eb86c..11f254ab 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -184,6 +184,9 @@ pub const View = struct {
window_pick: ?usize = null,
leader_keys: [4]u8 = undefined,
leader_n: u8 = 0,
+ /// Its tag out of rest: the which-key level, the typing states
+ /// (TagState.zig).
+ tag_state: pardes.TagState = .{},
/// The keyboard is on a header: a column's tag, or the workspace's.
header: ?Header = null,
/// A mouse sweep is extending the focused header's selection.
@@ -2010,11 +2013,12 @@ pub fn sync(p: *Pardes) void {
pane.tag_lead = lead;
}
// A row per shown row: the tag's lines wrapped at its width.
- var lines = std.mem.count(u8, tagline.curTail(pane), "\n") + 1;
+ const tail = tagline.shownTail(p, wa, pane) catch tagline.curTail(pane);
+ var lines = std.mem.count(u8, tail, "\n") + 1;
var wanted = lines;
var caret_row: usize = @intCast(@max(0, pane.tag.cur_row));
if (prefix) |made| wrap: {
- const whole = std.mem.concat(wa, u8, &.{ made, tagline.curTail(pane) }) catch break :wrap;
+ const whole = std.mem.concat(wa, u8, &.{ made, tail }) catch break :wrap;
const shown = tagline.wrapTag(p.settings.tab, wa, whole, tagline.tagWidth(p, id)) catch break :wrap;
lines = shown.rows();
// Collapsed, one row, as acme's Tagup sets taglines to 1
@@ -2033,6 +2037,10 @@ pub fn sync(p: *Pardes) void {
if (cur >= top + pane.tag_rows) top = cur + 1 - pane.tag_rows;
pane.tag_top = @intCast(@min(top, lines - pane.tag_rows));
} else pane.tag_top = 0;
+ // The band unrolled under the tag's text pushes the body down:
+ // the tag's rows, as everything under them counts them.
+ pane.band_rows = if (pane.collapsed) 0 else @min(pardes.Band.takes(p, id), r.h -| pane.tag_rows);
+ pane.tag_rows += pane.band_rows;
const cols = @max(1, r.w -| config.GUTTER);
// The tag steals the top rows. The pty is what the pane shows
// (layout keeps a terminal two body rows where the window has
@@ -2174,6 +2182,11 @@ pub fn nextWake(p: *const Pardes) ?u64 {
const wait = @max(1, (pane.question_due_ns - p.clock.stepped_ns + frame_ns - 1) / frame_ns);
frames = if (frames) |soonest| @min(soonest, wait) else wait;
};
+ // A which-key level shows at the end of its root's delay (TagState).
+ if (pardes.TagState.wake(p)) |due| {
+ const wait = @max(1, (due - p.clock.stepped_ns + frame_ns - 1) / frame_ns);
+ frames = if (frames) |soonest| @min(soonest, wait) else wait;
+ }
// A paste's Enter waiting on its REPL goes at the end of its wait,
// a time on the clock: the frames from `stepped_ns` that reach it.
for (p.panes) |slot| if (slot) |pane| if (pane.repl_enter > 0) {
@@ -2215,6 +2228,8 @@ fn advanceInner(p: *Pardes, now_ns: u64) void {
for (p.panes) |slot| if (slot) |pane| if (pane.question_due_ns == Pane.question_asked) {
pane.question_due_ns = now_ns + config.del_question_delay_ns;
};
+ // A which-key root struck since: its level's delay from now.
+ pardes.TagState.dated(p, now_ns);
const frame = frame_ns;
var moving: u32 = 0;
// The session's ticks are the recording session's: a picture still