Additive InputMode / OutputMode enums for menu settings#1071
Open
kronberger-droid wants to merge 5 commits into
Open
Additive InputMode / OutputMode enums for menu settings#1071kronberger-droid wants to merge 5 commits into
InputMode / OutputMode enums for menu settings#1071kronberger-droid wants to merge 5 commits into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Yup, pretty much inline with what I was thinking based on our other conversation. Thanks! |
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.
Adds
InputModeandOutputModeenums toMenuSettingswith their own builder methods.When set, they override
only_buffer_difference(kept for back-compat) and when unset, the bool path is preserved unchanged.Decouples menu input (what the completer receives) from output (what range of the buffer gets replaced on selection) if needed, which is the structural coupling behind #1006.
MenuSettings::effective_input_mode()resolves enum-over-bool precedence in one place and all four menu impls (Columnar/Description/Ide/ListMenu) go through it.replace_in_buffertakesOption<OutputMode>, alsoNoneandSome(SuggestedSpan)are equivalent.examples/demo.rsopts the history menu intoOutputMode::FullBuffer, demonstrating the pattern that fixes #1006 once nushell exposes the corresponding config field.Out of scope:
HistoryCompleter::create_suggestionspan update needed before HistoryMenu can useInputMode::FullBuffer(doc-comment warning added).Tests: precedence table for
effective_input_mode,FullBuffercase forcompleter_input, two cases forreplace_in_bufferwith explicitOutputModevariants.Full suite passes (843 + 28 doctests).
Manually verified via
cargo run --example demo: opened history menu mid-buffer, filtered, selected and the whole line replaced.