-
Notifications
You must be signed in to change notification settings - Fork 2
Editor: single-line / embeddable-input mode (Multiline property)
#155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
11
commits into
develop
Choose a base branch
from
copilot/feature-single-line-editor-input
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e20b7ac
Initial plan
Copilot b270f6c
feat: add Multiline property for single-line / embeddable-input mode
Copilot dca5811
Merge remote-tracking branch 'origin/develop' into copilot/feature-si…
Copilot a5d83be
fix: address CR feedback — strip newlines on transition, add paste te…
Copilot da32ef9
fix: show newline glyphs instead of stripping newlines in single-line…
Copilot eb2dccd
Merge branch 'develop' into copilot/feature-single-line-editor-input
tig a2a465b
fix: address code review — eliminate duplicated line lookup in GetOff…
Copilot b646a20
fix: address 5 CR items — scroll returns true, use visible lines for …
Copilot debf6eb
style: clean up inline namespace qualifications and comment in fold test
Copilot 7fbae39
Merge branch 'develop' into copilot/feature-single-line-editor-input
tig 20dd668
Merge remote-tracking branch 'origin/develop' into copilot/feature-si…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Single-Line / Embeddable-Input Mode | ||
|
|
||
| **Status**: Implemented | ||
| **Issue**: [#147](https://github.com/gui-cs/Editor/issues/147) | ||
| **Decision**: [DEC-008](../decisions.md#dec-008-single-line--embeddable-input-mode-resolves-former-open-006) | ||
|
|
||
| ## Summary | ||
|
|
||
| `Editor` supports a single-line input mode via the `Multiline` property (default `true`). | ||
| When `Multiline` is `false`, `Editor` behaves as a one-line text input suitable for embedding | ||
| in dialogs, forms, and tool bars — with syntax highlighting, selection, and all horizontal | ||
| editing intact. | ||
|
|
||
| ## Behavior when `Multiline == false` | ||
|
|
||
| | Aspect | Behavior | | ||
| |--------|----------| | ||
| | **Newline insertion** | `Command.NewLine` (Enter) is a no-op; prevents adding new newlines. | | ||
| | **Newline display** | Existing newlines in the document are preserved (no data loss) and rendered as visible glyphs (`⏎`). | | ||
| | **Word wrap** | Forced off; setting `WordWrap = true` is silently ignored. | | ||
| | **Vertical navigation** | `Up`, `Down`, `PageUp`, `PageDown` and their `*Extend` (Shift) variants are no-ops. | | ||
| | **Vertical scroll** | `ScrollUp` / `ScrollDown` are no-ops. Content height is always 1. | | ||
| | **Multi-caret** | `ToggleCaretAt`, `AddCaretVertically`, `SetVerticalCaretsFromViewRows` are no-ops. Existing additional carets are cleared on transition to `Multiline = false`. | | ||
| | **Paste** | Newlines (`\r\n`, `\r`, `\n`) are stripped from pasted content before insertion. | | ||
| | **Selection** | Works normally (horizontal). `SelectAll`, `Shift+Left/Right`, `Shift+Home/End` all function. | | ||
| | **Editing** | Insert, delete, backspace, undo/redo, cut/copy/paste all work. | | ||
| | **Horizontal navigation** | `Left`, `Right`, `Home`, `End`, word-left/right all work. | | ||
|
|
||
| ## Property | ||
|
|
||
| ```csharp | ||
| /// <summary> | ||
| /// Gets or sets whether the editor supports multiple lines. Default is <see langword="true" />. | ||
| /// </summary> | ||
| public bool Multiline { get; set; } = true; | ||
| ``` | ||
|
|
||
| Setting `Multiline` to `false`: | ||
| 1. Forces `WordWrap = false`. | ||
| 2. Clears any additional carets (`ClearAdditionalCarets`). | ||
| 3. Clears visual-line caches and recomputes content size (height = 1). | ||
| 4. Preserves existing document content (no data loss) — newlines are rendered as `⏎` glyphs. | ||
| 5. Home/End navigate to document start/end (since the visual representation is one row). | ||
|
|
||
| ## Not in scope (this phase) | ||
|
|
||
| - `EnterKeyAddsLine` — when `false`, Enter raises `Accepting` instead of `Command.NewLine`. | ||
| - `TabKeyAddsTab` — when `false`, Tab falls through to focus traversal. | ||
| - These are tracked in [#147](https://github.com/gui-cs/Editor/issues/147) as follow-up work. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.