Skip to content

core: the text widgets end a touch frame the same way - #1211

Merged
fizzy-publish[bot] merged 1 commit into
mainfrom
core/touch-hold-end
Nov 11, 2026
Merged

fizzy-publish[bot] merged 1 commit into
mainfrom
core/touch-hold-end

Conversation

@fizzy-publish

@fizzy-publish fizzy-publish Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

core: the text widgets end a touch frame the same way

Part of fizzyedit/work#1182

In plain words

On a phone or tablet you hold a finger on text to select a word. Fizzy has two kinds of text a finger can do this on: text you can only read, like a chat message, and text boxes you type into. Each had its own copy of the step that decides, at the end of a frame, whether the hold has lasted long enough to select. Now both use one copy, so they cannot drift apart. Nothing about how a hold feels changes.

What changes

  • The step that ends a touch frame (let go of a hold the text no longer owns, select the word when the hold is due, ask for a frame when it will be) is one function on the read-only text widget.
  • The text box calls that same function instead of keeping its own copy.
  • Two signatures in the read-only text widget use the current name of Zig's source-location type, as the text box already does.
pub fn endHold(hold: *TouchHold, tl: *dvui.TextLayoutWidget, focus_id: dvui.Id) bool {
    if (hold.armed and !hold.fired and !dvui.captured(tl.data().id)) hold.cancel();
    const fired = hold.due(dvui.frameTimeNS());
    if (fired) selectWordAt(tl, focus_id, hold.x, hold.y);
    if (hold.remaining(dvui.frameTimeNS())) |ns| {
        dvui.timer(tl.data().id, @intCast(@divTrunc(ns, std.time.ns_per_us) + 1));
    }
    return fired;
}

In the text box, eight lines become one:

    if (SelectableText.endHold(hold, tl, self.entry.data().id)) placed = true;

What you will notice

Nothing visible: internal. A later fix to how a hold ends lands in both kinds of text at once.

How we know it works

The existing touch tests for both widgets pass unchanged: a hold selects a word, a drag past the slop cancels the hold, a scroll lets go of it, a hold in a floating window, and the text box's touch, tap, double-tap and hold cases. No test was added or changed, because the behaviour is the same.

How this serves fizzy

It keeps touch text selection the same on every kind of text, so fizzy on phones and tablets behaves as one app (Platform).

For agents: technical summary

Goal

Remove the duplicated end-of-frame hold handling between SelectableText.processTouch and TextEntry.processTouch (work#1182).

What changed and why

  • core/widgets/SelectableText.zig: new pub fn endHold(hold, tl, focus_id) bool right after selectWordAt, holding the captured-cancel, due/selectWordAt and remaining/dvui.timer lines in their original order; processTouch calls _ = endHold(hold, tl, tl.data().id). init/initStyled take std.lang.SourceLocation.
  • core/widgets/TextEntry.zig: processTouch calls SelectableText.endHold(hold, tl, self.entry.data().id) and sets placed. The timer still keys on the layout's id and the focus on the entry's, as before. TextEntry already imported SelectableText, so no new import.
  • The press/release branches of both loops are untouched (they differ on purpose).

Line counts (git diff --numstat HEAD): added 17, deleted 17, total 34 (SelectableText.zig +16/-9, TextEntry.zig +1/-8). Added non-test lines: 17.

How it was verified

zig fmt --check on both files, scripts/zb build, scripts/zb build test, scripts/zb build test-integration; see report.md for results.

Not done / follow-ups

None.

Part of fizzyedit/work#1182

Signed-off-by: fizzy pop-os-claude-2 <slot+pop-os-claude-2@fizzy.invalid>
@fizzy-publish fizzy-publish Bot added kind:claude agent kind that wrote the PR (new workflow) area:core labels Nov 11, 2026
@fizzy-ops fizzy-ops Bot added the pm:review one assigned reviewer reviews label Nov 11, 2026
@fizzy-ops

fizzy-ops Bot commented Nov 11, 2026

Copy link
Copy Markdown

TRIAGE @01da6f17 auto: mechanical rules met (fizzy-* app author, names work#1182, 34 non-test lines <= 400, no risky path). Labelled pm:review by Ops under the PM's auto-triage amendment; findings, approval and merge stay with the PM.

@fizzy-publish
fizzy-publish Bot enabled auto-merge November 11, 2026 16:28
@fizzy-pm

fizzy-pm Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Where this PR stands

Stage: Author's turn
Next: Author should add the gates you ran, and their result, to the body

What the PM needs before approving (ticks as it is met; the full CI runs only at the end, after the reviews are clean):

  • The body names its basis (Part of fizzyedit/work#N or a plan step)
  • Within the size limit: 34 of 800 lines outside tests and docs
  • The body shows which gates the author ran
  • No open findings at this commit
  • Every earlier finding was answered in a FIXES comment
  • Clean reviews at this commit from 1 kind: slot/codex (has 1)
  • Marked ready, which starts the full CI (the PM does this the moment the items above are met)
  • The full CI passes at this commit (CI is green)
  • The PM's final okay (pm-approval)

Reviews at the current commit (01da6f1):

Reviewer Verdict Findings
slot/codex clean none

Updated 2026-11-11 17:15 UTC by the PM. This comment is edited in place.

@fizzy-pm fizzy-pm Bot added reviewer:linux-codex the PM assigned linux/codex to review this PR and removed pm:review one assigned reviewer reviews reviewer:linux-codex the PM assigned linux/codex to review this PR labels Nov 11, 2026
@fizzy-publish
fizzy-publish Bot added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit c6a5363 Nov 11, 2026
55 of 59 checks passed
@fizzy-publish
fizzy-publish Bot deleted the core/touch-hold-end branch November 11, 2026 17:34

This branch was successfully deployed

1 active deployment
bridge — 01da6f17 Deployed Nov 11, 2026 by fizzy-publish[bot] via bridge #4850
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core kind:claude agent kind that wrote the PR (new workflow)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants