▍ humdrum codex / glint v1.1.2
license AGPL-3.0
5.8 KB raw

New-file naming dialog & editor filename header

Date: 2026-07-30

Problem

Creating a note in glint leaves the buffer unnamed. The name is asked for later, at the first Ctrl+S, through a one-line prompt in the bottom status bar (ModeSaveAs). Two consequences:

Goals

  1. Ask for the filename up front, in a centered dialog, whenever a new file is made.
  2. Show the filename in editor mode as an uneditable header bar, styled like the title bar preview already renders.
  3. Collapse the two naming UIs (save-as, new-file) into one component, and reuse it for renaming an existing file.

Design

Approach

A new internal/dialog package holds the centered prompt as a self-contained Bubbletea sub-model: prompt title, target-directory hint, text input, validation, and Enter/Esc handling. App owns a *dialog.Model and a new ModeNamePrompt.

legibleText and hexToRGB move from internal/preview into internal/theme, so the editor header and the preview title bar derive their colors from one place and cannot drift apart.

Alternatives considered and rejected:

The dialog

A centered bordered box on the canvas, in the same visual family as helpOverlay: rounded border in theme.Heading, themed background.

        ╭────────────────────────────────╮
        │  New note                      │
        │  in ~/Humdrum/Inbox/           │
        │                                │
        │  > my-new-note▌                │
        │                                │
        │  Enter to create · Esc cancel  │
        ╰────────────────────────────────╯

One component, two uses:

Use Title Prefill Confirm
New New note picker query, if any create empty file, open it
Rename Rename current basename os.Rename, rebind path

Behavior:

The header

The header occupies the existing three-row top pad (canvasTopPad = 3), so it costs no text rows and the editor's height is unchanged:

row 0   (blank pad)
row 1   ██ my-note ████████████████████   ← header bar
row 2   (blank pad)
row 3+  document text (unchanged height)

Wiring

Testing