Skip to content

feat: add column fitting commands - #34

Open
dl-alexandre wants to merge 3 commits into
maaslalani:mainfrom
dl-alexandre:feat/column-fit-commands
Open

dl-alexandre wants to merge 3 commits into
maaslalani:mainfrom
dl-alexandre:feat/column-fit-commands

Conversation

@dl-alexandre

Copy link
Copy Markdown
Contributor

Summary

  • add per-column width support so rendering, editing, scrolling, and mouse selection can respect fitted columns
  • add :fit to size the selected column to its displayed contents and :fit width to spread visible columns across the terminal width
  • cover the new fitting behavior with command and mouse-hit tests, and document the commands in the README

Testing

  • go test ./...

Closes #20
Closes #21

Let users fit the current column to its contents or size visible columns to the terminal width so the grid uses space more effectively.
Run GoReleaser in snapshot mode on PRs so CI validates release packaging without requiring a matching tag.
@maaslalani

Copy link
Copy Markdown
Owner

Thank you this is great!

Would you be open to changing this to allow the user to manually set the column width?

I was thinking a :resize 20 command to change the current column to 20 width, etc... and then maybe having a :resize auto to fit content or :resize content, etc...

Rename the fitting interface around a  command so users can set an explicit column width or resize to content or screen width.
@dl-alexandre

Copy link
Copy Markdown
Contributor Author

Updated the PR to use a command family.

Included:

  • to set the current column width explicitly
  • / to fit the current column to content
  • to size the visible columns to the terminal width

I also updated the tests and README, and ? github.com/maaslalani/sheets [no test files]
ok github.com/maaslalani/sheets/internal/sheets (cached) is still passing.

@dl-alexandre

Copy link
Copy Markdown
Contributor Author

Updated the PR to use a :resize command family.

Included:

  • :resize 20 to set the current column width explicitly
  • :resize auto / :resize content to fit the current column to content
  • :resize width to size the visible columns to the terminal width

I also updated the tests and README, and go test ./... is still passing.

@erhhung

erhhung commented Apr 11, 2026 •

Copy link
Copy Markdown

Would be nice to have shortcut keys for manually resizing the current column, e.g.

Ctrl-, — 1-char narrower
Ctrl-. — 1-char wider
Ctrl-/ — :resize auto

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.

Feature request: Fit to screen width Feature request: Column width fitting

3 participants