Skip to content

feat: make columnar menu traversal direction configurable - #951

Merged
ysthakur merged 3 commits into
nushell:mainfrom
simonborje:configurable_menu_traversal_dir
Sep 20, 2025
Merged

ysthakur merged 3 commits into
nushell:mainfrom
simonborje:configurable_menu_traversal_dir

Conversation

@simonborje

Copy link
Copy Markdown
Contributor

An attempt to fix #928 by making columnar menu traversal direction configurable.

ColumnarMenu::default().with_traversal_direction(TraversalDirection::Horizontal)

WindowsTerminal_Z1fm3UOu09

ColumnarMenu::default().with_traversal_direction(TraversalDirection::Vertical)

WindowsTerminal_fYqosstrqW

I've prepared changes for exposing this setting to the nushell configuration (currently at simonborje/nushell@e42a31d) that I can post as a PR if this change is accepted.

I've tested these changes manually using nushell with the configuration patch mentioned above. It seems to work as I intended in the scenarios I have tried, but there might be situations where something goes wrong.

I'm not sure what the best name for the setting would be, initially I used sort_order, and tab_traversal has been suggested - I went with traversal_direction for now.

@orthonormalremy

Copy link
Copy Markdown

does this PR also support configuring the number of columns ? Specifically I'm curious if this would allow me to set the number of menu columns to 1.

e.g.

> cd
option1/
option2/
option3/

@simonborje

Copy link
Copy Markdown
Contributor Author

Setting columns: 1 in

$env.config.menus ++= [{
    type: {
        layout: columnar          # Type of menu
        columns: 1                # Number of columns where the options are displayed

seems to achieve that.

@orthonormalremy

Copy link
Copy Markdown

Setting columns: 1 in

$env.config.menus ++= [{
    type: {
        layout: columnar          # Type of menu
        columns: 1                # Number of columns where the options are displayed

seems to achieve that.

Thank you! 🐐

@cptpiepmatz
cptpiepmatz self-requested a review September 17, 2025 23:38
@fdncred

fdncred commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

Thanks for this. This has literally been requested for years. Hopefully we can land it soon.

Comment thread src/menu/columnar_menu.rs Resolved
Comment thread src/menu/columnar_menu.rs Resolved
Comment thread src/menu/columnar_menu.rs Resolved

@cptpiepmatz cptpiepmatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that deep into reedline's codebase but this looks reasonable 👍

@ysthakur ysthakur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried it, LGTM

@ysthakur
ysthakur merged commit 68084cd into nushell:main Sep 20, 2025
@ysthakur ysthakur added the A-Completions Area: Tab completion and inline hint completions label Sep 20, 2025
@fdncred

fdncred commented Sep 20, 2025 •

Copy link
Copy Markdown
Contributor

@simonborje Would you mind creating a nushell PR with the latest reedline commit and changes needed to demonstrate this change in nushell? (looks like you already have one ready if you could send it in - thanks)

@simonborje

Copy link
Copy Markdown
Contributor Author

I submitted a related nushell PR for adding a configuration option: nushell/nushell#16724

fdncred added a commit to nushell/nushell that referenced this pull request Sep 22, 2025
Make columnar menu tab traversal direction configurable. The
configurable traversal direction feature was added to `reedline` with
nushell/reedline#951. This PR makes that
configuration option available in `nushell`.

## Release notes summary - What our users need to know

The feature makes it possible to choose the direction that items are
placed in the columnar menu. With the default value of `"horizontal"`,
items are ordered left-to-right in each row, with later items appearing
in rows below earlier items.
```
1   2   3   4
5   6   7   8
9   10
```
With the value set to `"vertical"`, items are ordered top-to-bottom in
each column, with later items appearing in columns to the right of
earlier items.
```
1   4   7   10
2   5   8
3   6   9
```

The configuration option is currently called "tab_traversal" with a
default value of "horizontal".
A specific revision of reedline is pointed to in cargo.toml since the
required changes are not available in any released version of reedline.



## Tasks after submitting
<!-- Remove any tasks which aren't relevant for your PR, or add your own
-->
- [ ] Update the
[documentation](https://github.com/nushell/nushell.github.io)

---------

Co-authored-by: Darren Schroeder <[email protected]>
benvansleen added a commit to benvansleen/reedline that referenced this pull request Oct 26, 2025
* fix: prompt glitch when resizing with cursor in a multiline command (nushell#898)

* fix: prompt glitch when resizing with cursor in a multiline command

* fix: considering line wraps

* fix: clippy

* Bump version to `0.41.0` (nushell#936)

* Protect against invalid suggestion spans (nushell#915)

* Protect against invalid suggestion spans

* Protect against start > end

* feat: Builder option to immediately accept input (nushell#933)

* feat: Option to immediately accept input

* chore: PR feedback

* feat: add `ViChangeMode` event (nushell#932)

* feat: add `ViChangeMode` event

* fix: use `FromStr` trait

* fix: undo unused change

* fix: clippy

* Fix `mismatched_lifetime_syntaxes` (nushell#947)

From Rust 1.89.0 on this lints.
https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint

* Fix missing import in README.md (nushell#942)

Co-authored-by: sholderbach <[email protected]>

* fix: dislocation of cursor after previous_history navigation to a multiline entry (nushell#899)

* bumping version to 42 (nushell#949)

Co-authored-by: Jack Wright <[email protected]>

* Bump `rusqlite` to 0.37 (nushell#950)

* feat: make columnar menu traversal direction configurable (nushell#951)

* Make columnar menu traversal direction configurable

* Add tests for columnar menu selection position updates

* Apply changes based on review

* Upgrade GitHub Actions and Rust toolchain versions (nushell#954)

* Upgrade GitHub Actions and Rust toolchain versions

* Update .github/workflows/ci.yml

* Vi mode text objects for word, WORD, brackets and quotes (nushell#939)

* Addd initial change inner and around word text objects and handle whitespace

Note a buffer full of whitespace is not properly considered and still
causing incorrect behaviour. TODO fix this.

* Renaming functions and fix default value of current_whitespace_range_start

* Rename cut/yank inside enums and methods to cut/yank inside pair and add general yank/cut range methods

* Use TextObject enum instead of passing through the character

* WIP: Add quote and bracket text objects and add jumping if not inside objects

* Add my own methods for finding matching pair and jumping

* Fix bugs in new function to get matching pair range and it's finish features

- Now handles jumps to next open/close or equal symbol pairs if not in a
pair already
- Searching only on current line for equal symbol pairs e.g. quotes
- Correctly handles graphemes

* Simplify heirarchy of pair range finding functions

- Refactor the structure of the methods to get ranges, don't need to
pass in depth unecessarily, high level functions don't require cursor
passed in.
- Now two seperate functions for ranges, one "next" and one "current"
range that gets you either the range inside next text object or inside
current one depending on position of cursor.
- Finilise logic to correctly handle graphemes (not byte sized chars)

TODO Update unit tests

* Refactoring range functions and tidy up/extend unit test cases and coverage

* More refactoring

- Improve some text object ranges to use iterators rather than complex
logic
- Clean up documentation, add consts etc
- Look through and refactor some editor functions

* Move text object range methods into line_buffer from editor

* Combine line_buffer quote and pair text object functions into generic and rewrite a lot of doc strings

* Testing for quote and bracket text object functions in editor.rs

* Whitespace

* Rework unit tests for new function structure

* Remove angle brackets from b text object

* Rename yank text object functions to copy

* Add bracket test cases to range_inside_next_pair_in_group unit tests

* Add more detailed unicode safety tests

* Fix display enum string for renamed enums

* Unicode and overflow/underflow safety when expanding text object ranges

* Pass through matching pair group const for quote and bracket text object functions

* Rename yank_range -> copy_range for consistency with other methods

* Remove unecessary guard clause from expand_range_to_include_pair

* Correct display string for CutInsidePair

* Make text object types public (nushell#957)

* Make TextObject, TextObjectScope and TextObjectType public

* Correct CopyInsidePair and CopyAroundPair EditType to NoOp

* fix: dislocation of cursor during history navigation (nushell#959)

* fix: dislocation of cursor during history navigation

* test: new test case by Claude Sonnet

* simplify

* Fix typos (nushell#962)

* Bump version for `0.43.0` release (nushell#961)

* Fix shift selection in vi (insert) & emacs mode (nushell#927)

* Add match_indices field to Suggestion (nushell#798)

* Add match_indices field to Suggestion

Make columnar_menu use match indices

Make ide menu use match indices

Add fuzzy completions example

Test style_suggestion

Make doctests in default.rs pass

Highlight entire graphemes

Extract ANSI escapes from strings to apply match highlighting

Fix clippy lint for fuzzy completion example

Shut the typo checker up

Use existing variable `escape`

Copy regex from parse-ansi crate

* replace LazyLock with lazy_static that works with Rust 1.63.0 (#2)

* Homegrown ANSI parser

Fix padding for columnar menu

Highlight substring matches too by default

Simplify (?) columnar menu

* Fix clippy lints after rebase

* Use get_match_indices helper

* Stop using 'fo' because it's a typo? Fo shizzle.

* Use to_string() instead of as_str()

* Style entire suggestion same color

* RESET after suggestion

---------

Co-authored-by: Divanshu Grover <[email protected]>

* fix bashism parsing (nushell#958)

* refactor: use crossterm `supports_keyboard_enhancement` once when KittyProtocolGuard is initialized (nushell#920)

Co-authored-by: Pierre POLLET <[email protected]>

---------

Co-authored-by: zc he <[email protected]>
Co-authored-by: Stefan Holderbach <[email protected]>
Co-authored-by: Yash Thakur <[email protected]>
Co-authored-by: Stuart Carnie <[email protected]>
Co-authored-by: Daniel Bonofiglio <[email protected]>
Co-authored-by: Daniel del Castillo <[email protected]>
Co-authored-by: Jack Wright <[email protected]>
Co-authored-by: Jack Wright <[email protected]>
Co-authored-by: Piepmatz <[email protected]>
Co-authored-by: simonborje <[email protected]>
Co-authored-by: Darren Schroeder <[email protected]>
Co-authored-by: JonLD <[email protected]>
Co-authored-by: Collin Murch <[email protected]>
Co-authored-by: Divanshu Grover <[email protected]>
Co-authored-by: migraine-user <[email protected]>
Co-authored-by: PtiBouchon <[email protected]>
Co-authored-by: Pierre POLLET <[email protected]>
kronberger-droid pushed a commit to skull-squadron/reedline that referenced this pull request Jun 1, 2026
* Make columnar menu traversal direction configurable

* Add tests for columnar menu selection position updates

* Apply changes based on review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Completions Area: Tab completion and inline hint completions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nu-complete: vertical cycling through completion values

5 participants