Repository navigation
Add --spreadsheet option to show column letters in the header - #207
Open
ChrisJr404 wants to merge 1 commit into
Open
ChrisJr404 wants to merge 1 commit into
ChrisJr404 wants to merge 1 commit into
Conversation
This adds an opt-in --spreadsheet flag that prefixes each header cell with its spreadsheet-style column letter (A, B, C, ..., Z, AA, ...), so columns can be referred to by letter the way they are in Excel or Google Sheets. The letters are derived from each column's original position in the file (origin_index), so they remain correct and stable when scrolling horizontally or when a columns filter is active. The feature is off by default and reuses the existing effective-column-name path, so it composes with sort indicators and column width computation without any layout change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an opt-in
--spreadsheetflag that displays spreadsheet-style column letters (A, B, C, ..., Z, AA, ...) alongside the column names in the header, addressing #87.The motivation from that issue is being able to refer to columns by letter the way you would in Excel or Google Sheets ("look at column Z"). When
--spreadsheetis passed, each header cell is prefixed with its letter, e.g.[A] country,[B] population.A few implementation notes:
origin_index), not its on-screen position, so they stay correct and stable when scrolling horizontally or when a columns filter is active.get_effective_column_namepath, the same place the sort indicator is added, so it composes with sorting and flows through column-width computation with no changes to the layout/border rendering.--spreadsheetis passed.I went with prefixing the existing header row (rather than adding a separate letters row) to keep the change small and avoid touching the border/offset math, but I'm happy to adjust the presentation if you'd prefer something different.
Testing: added a rendered-buffer snapshot test (
test_spreadsheet_column_letters) and a unit test for the letter conversion covering the A/Z/AA/ZZ/AAA boundaries.cargo test --features clipasses (108 tests), andcargo fmt --checkandcargo clippy --features cli --libare clean.