This document captures design and implementation notes for TextArea.
For end-user usage and examples, see TextArea.
TextEditorBase).Tab and EnterAlign.Stretch)SearchReplacePopup (find/replace) arranged inside the editor surface.TextArea : TextEditorBase (sealed)TextArea():
AcceptTab = true, WordWrap = trueHorizontalAlignment/VerticalAlignment = Align.StretchTextDocument to a DynamicTextDocument bound to TextSearchReplacePopupTextEditor.Find (Ctrl+F)TextEditor.Replace (Ctrl+H)TextArea(string? text) sets initial Text.Text : string?Most editing behavior is configured through inherited bindables on TextEditorBase (e.g. WordWrap, AcceptTab, Placeholder, selection/caret state, etc.).
TextArea uses a fixed default size (clamped by constraints):
width = 32height = 10SizeHints.Fixed(constraints.Clamp(...))Arrange computes a padded content rectangle:
contentRect = finalRect minus TextAreaStyle.PaddingUpdateEditorLayout(contentRect) updates the editor’s internal scroll model and layout (caret, wrapping, viewport)_searchPopup.ArrangeWithin(contentRect) places the popup inside the editor surfaceTextAreaStyle.BackgroundStyle(theme, focused).RenderEditor(...) into contentRect using:
TextAreaStyle.SelectionStyle(theme)TextAreaStyle.PlaceholderStyle(theme, focused)SearchReplacePopup renders as a child overlay within the same content region.Because TextEditorBase implements IScrollable, a TextArea provides a ScrollModel to containers like ScrollViewer.
Important implication:
ScrollViewer, the viewer will prefer the content-owned scroll model mode (it will not call ScrollModel.SetViewport and will derive bar visibility from the model’s extent/viewport).TextArea registers commands so that they are discoverable through UI surfaces like CommandBar / CommandPalette:
Ctrl+F: open findCtrl+H: open replaceThe popup open logic is implemented via TryOpenSearchReplacePopup(...) and delegates to the internal _searchPopup.
TextAreaStyle controls:
Padding (default Thickness(1,0,1,0))Border, FocusBorder, Selection, Background, PlaceholderTheme.InputFill / Theme.InputFillFocused and surface colors as fallbackssrc/XenoAtom.Terminal.UI.Tests/TextAreaTests.cssrc/XenoAtom.Terminal.UI.Tests/TextAreaSearchReplaceTests.cssrc/XenoAtom.Terminal.UI.Tests/TextEditorAutoScrollTests.cssrc/XenoAtom.Terminal.UI.Tests/TextEditorUndoRedoTests.cssrc/XenoAtom.Terminal.UI.Tests/GraphemeEditingTests.cssrc/XenoAtom.Terminal.UI.Tests/ScrollViewerTextAreaInteractionTests.cs