summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 835eb86c..d0c9976d 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
@@ -2174,6 +2178,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 +2224,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