Skip to content

Default the interactive header column prompt to the first column - #1158

Open
ChrisJr404 wants to merge 1 commit into
noborus:masterfrom
ChrisJr404:header-column-default-one
Open

Default the interactive header column prompt to the first column#1158
ChrisJr404 wants to merge 1 commit into
noborus:masterfrom
ChrisJr404:header-column-default-one

Conversation

@ChrisJr404

Copy link
Copy Markdown

This makes the interactive header_column command (default key Y) default to the first column when confirmed with no input, so the common case no longer requires typing a value.

As noted in #740, header_column currently prompts for a number and reports "invalid number" if you just press Enter. In practice the value is almost always 1 (pin the first column as a vertical header), so requiring it to be typed every time is a small but constant bit of friction. With this change, confirming the prompt with an empty input sets the header column to 1; any non-empty value is still parsed and validated exactly as before, and a non-numeric entry still reports an invalid number. Existing behavior for explicit values is unchanged.

The change is scoped to setHeaderColumn, which is only reached from the interactive prompt's confirm handler, so nothing else is affected.

Testing: updated TestRoot_setHeaderColumn so the empty-input case now expects 1, and ran go test ./... (all packages pass) plus go vet ./oviewer/ and gofmt.

When the header_column command (default key Y) prompts for a value,
confirming with an empty input now sets the header column to 1 instead
of reporting an invalid number. Selecting the first column is by far the
most common case, so it makes a sensible default and saves a keystroke.

Refs noborus#740
@noborus

noborus commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Thank you for the proposal regarding ov.

I agree that entering numbers in header_column is a hassle.
I recommend using F instead of Y.
For the common case of fixing the first column, users can press F while the cursor is on the first column. This is simpler than pressing Y, entering 1, and confirming with Enter. The F command also naturally supports fixing the column under the cursor.

For users who always want the first column fixed in column mode, configuring the following is sufficient:

General:
  HeaderColumn: 1

The same setting can also be specified for an individual view mode. Since HeaderColumn is already applied when the document is displayed in column mode, no additional behavior is required.

With these workflows, Y remains useful for explicitly setting a different number of header columns. Therefore, an empty input to header_column should not implicitly set the value to 1; it should remain invalid as it is today. This keeps the meaning of Y explicit and avoids making an empty confirmation perform an unexpected change.

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.

2 participants