Skip to content

A schema, and a choice in a form, are picked from a list - #7

Open
zales wants to merge 1 commit into
mainfrom
feat/pick-from-a-list
Open

zales wants to merge 1 commit into
mainfrom
feat/pick-from-a-list

Conversation

@zales

@zales zales commented Oct 10, 2026

Copy link
Copy Markdown
Owner

One thing out of several was chosen by turning a field a name at a time. It is now picked from a list, the way a command is picked in the palette.

What changes

  • # - schema on PostgreSQL, namespace on Kubernetes, database on MySQL, vhost on RabbitMQ - opens the names one under another, with the cursor on the one in force and that one marked now. Typing narrows the list, the arrows move, enter moves to the one under the cursor, esc leaves things as they were.
  • enter or space on a choice in a form opens the same list on what that choice can be. Left and right still turn it to the one beside it, and tab still goes to the next value.
  • The form with one field that # used to open is gone.

How

  • src/tui/picker.zig is the list: the names, copied; the matches, ranked the way the palette ranks its actions.
  • draw.zig draws the palette and this list through one panel. The palette's picture in docs/ is byte for byte what it was.

Checked

  • Unit tests: seven new ones for the list, and the size sweep opens it at every size.
  • tests/postgres.sh, tests/k8s.sh, tests/rabbit.sh press the keys as they now are; mysql, sftp, sizes, keys, saved, csv, connecting, smoke and shots pass unchanged.

One thing out of several was chosen in two ways, and neither was a list.
`#` - the schema on PostgreSQL, the namespace on Kubernetes, the database
on MySQL, the vhost on RabbitMQ - opened a form with one field in it,
turned with the left and right arrows a name at a time and sent with
ctrl+s: a cluster with thirty namespaces was up to twenty-nine presses to
reach the one whose name was known all along. A choice inside a form was
the same field with the same arrows - the table a foreign key points at,
out of however many tables there are.

The command palette already had the answer: a list, narrowed by a few
letters, with enter for the one under the cursor. That list is now what
both of these are.

`#` opens the schemas one under another, with the cursor on the one in
force and that one marked "now". Typing narrows the list and puts the best
match first, the arrows, page up and page down and ctrl+n and ctrl+p move
in it, enter moves to the one under the cursor and esc leaves things as
they were. Enter on the one already in force says so and reads nothing
again.

Enter or space on a choice in a form opens the same list on what that
choice can be, and enter in it sets the field - the connection form builds
itself again for another engine, exactly as it does when the arrows turn
it. Left and right still turn a choice to the one beside it, which for a
choice of two is all anybody wants, and tab still goes to the next value.
Enter went to the next value everywhere in a form; it still does on every
field that is not a choice.

The list is `src/tui/picker.zig`: the names, copied, because what they were
read from may be gone before one is chosen; the matches, ranked the way the
palette ranks its actions - every word typed has to be in the name, one
that is there as a piece counts for more, and at the start for more again,
so `pay` is `payments` before it is `prepay`. The panel is the palette's:
`draw.zig` draws both through one function, and the palette's picture in
`docs/` comes out byte for byte what it was.

The form with one field that `#` used to open is gone, with its purpose
and what was done with its answer.

The suites press the keys as they now are: the PostgreSQL one lists the
schemas, moves to one by three letters and leaves on esc; the Kubernetes
one does the same with a namespace and looks for that namespace's pods;
the RabbitMQ one types the vhost where it turned to it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant