Commit Graph

8492 Commits

Author SHA1 Message Date
Tig
d1ef1aa9cb Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-26 10:22:14 -07:00
Tig
2d6f60cca6 Fixes #4615 - Clamps Dialog Frame size to container (#4632)
* fixed bug

* Refactor DialogTests and add sizing regression tests

- Refactored DialogTests.cs to use concise object and array initializers, improving readability and consistency.
- Added two regression tests to ensure Dialog sizing never exceeds screen/container bounds:
  - Dialog_Frame_Clamped_To_Container
  - Dialog_Height_Never_Exceeds_Screen_Height
- Updated drawing tests to use indented multiline string literals for expected output.
- Improved test output with additional debug info via ITestOutputHelper.
- Made minor code cleanups (e.g., variable declarations, property immutability).
- No changes to Dialog implementation; all updates are to test code only.
2026-01-26 10:18:20 -07:00
Tig
b945cf3f55 Merge branch 'v2_release' into v2_develop 2026-01-25 15:29:35 -07:00
Tig
61cdffcc37 enhanced Example.cs 2026-01-25 15:29:12 -07:00
Tig
c5d17de0af Merge branch 'v2_release' of tig:gui-cs/Terminal.Gui into v2_release 2026-01-25 15:20:42 -07:00
Tig
024adb1744 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-25 14:59:13 -07:00
Tig
63ced6e16f Merge branch 'gui-cs:v2_develop' into v2_develop 2026-01-25 11:42:37 -07:00
Tig
e2bf068762 Merge/v2 alpha 4109 (#4629)
* New workflow that will analyze the dmp file on the macos runner.

* Refactor View props; update docs for new template install

Refactored View.Enabled and View.Visible to use auto-properties
with initial values, removing private backing fields and updating
setters to use 'field'. Updated comments for clarity.

Revised README.md and getting-started.md to use the new
dotnet new install Terminal.Gui.Templates@2.0.0-alpha.* syntax
for template installation and updated sample usage instructions
to match the latest versioning and installation approach.
2026-01-25 11:42:29 -07:00
Tig
d2afa500f7 Merge branch 'gui-cs:v2_develop' into v2_develop 2026-01-25 11:42:14 -07:00
Tig
d58bbb2298 Refactor View props; update docs for new template install
Refactored View.Enabled and View.Visible to use auto-properties
with initial values, removing private backing fields and updating
setters to use 'field'. Updated comments for clarity.

Revised README.md and getting-started.md to use the new
dotnet new install Terminal.Gui.Templates@2.0.0-alpha.* syntax
for template installation and updated sample usage instructions
to match the latest versioning and installation approach.
2026-01-25 11:39:48 -07:00
Tig
d98661e1c1 Merge branch 'v2_develop' into v2_release 2026-01-25 11:17:12 -07:00
Tig
c6009b8829 Merge branch 'v2_release' of tig:gui-cs/Terminal.Gui into v2_release 2026-01-25 11:16:52 -07:00
Tig
db48a5d820 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-25 08:59:25 -07:00
Tig
6df5c26784 Fixes #4623 - Makes SetNeedsDraw signal other sessions; fixes focus issue on 2nd runnables (#4626)
* New workflow that will analyze the dmp file on the macos runner.

* Fixes #4629 -

* Update Terminal.Gui/App/Keyboard/KeyboardImpl.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add redraw propagation and arrangement tests, refactor tests

Adds new tests to verify redraw propagation when moving views
and when multiple runnables are stacked, addressing issues
#4623 and #4629. Refactors existing tests in
BorderArrangementTests.cs and NeedsDrawTests.cs for clarity,
resource management, and consistency. Improves object
initialization, assertion messages, and removes unnecessary
code. Ensures redraw logic is robust in complex view
arrangements and improves overall test reliability.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-25 08:19:35 -07:00
Tig
2f30660f5c Merge branch 'gui-cs:v2_develop' into v2_develop 2026-01-25 07:25:15 -07:00
Copilot
a4ce6fb4d3 Refactor MouseGrabView to WeakReference-based IsGrabbed() method (#4613)
* Initial plan

* Refactor MouseGrabView to WeakReference - Core implementation complete

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Replace MouseGrabView with IsGrabbed(view) in test files

Updated test files to use the new IsGrabbed(view) method instead of the deprecated MouseGrabView property:
- Assert.Equal(view, mouse.MouseGrabView) → Assert.True(mouse.IsGrabbed(view))
- Assert.Null(mouse.MouseGrabView) → Assert.False(mouse.IsGrabbed(anyView))
- mouse.MouseGrabView == view → mouse.IsGrabbed(view)
- mouse.MouseGrabView != view → !mouse.IsGrabbed(view)
- Updated method names and comments referencing MouseGrabView

Files updated:
- Tests/UnitTests/Application/Mouse/ApplicationMouseTests.cs
- Tests/UnitTestsParallelizable/ViewBase/Mouse/HighlightStatesTests.cs
- Tests/UnitTestsParallelizable/Application/RunTests.cs
- Tests/UnitTestsParallelizable/Application/Runnable/RunnableIntegrationTests.cs
- Tests/UnitTestsParallelizable/Application/ApplicationImplTests.cs
- Tests/UnitTestsParallelizable/Application/InitTests.cs
- Tests/UnitTests/View/Adornment/ShadowStyleTests.cs
- Tests/UnitTests/View/ArrangementTests.cs
- Tests/UnitTests/View/Mouse/MouseTests.cs

All tests pass successfully.

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Complete MouseGrabView refactoring - tests and documentation updated

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix mouse grab enter/leave logic - check grab state first

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Improve null-conditional pattern consistency for IsGrabbed calls

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix code style - use target-typed new() for WeakReference

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Code clean up and org.

* Code cleanup and better docs.

* Add IMouseGrabHandler.IsGrabbed() and related tests

Introduce a new parameterless IsGrabbed() method to IMouseGrabHandler, allowing checks for any active mouse grab regardless of view. Implement this method in MouseImpl, using WeakReference to determine grab state. Add comprehensive unit tests in ApplicationMouseTests and MouseInterfaceTests to verify correct behavior across grab, ungrab, disposal, and state reset scenarios. Also, perform minor code cleanups in MouseInterfaceTests.cs for clarity and consistency.

* code cleanup

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
2026-01-25 07:25:02 -07:00
Tig
38e98b9d9d Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-24 11:41:15 -07:00
Tig
459ad019bf Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-24 06:50:48 -07:00
Tig
27c18a3a21 Merge branch 'gui-cs:v2_develop' into v2_develop 2026-01-24 06:50:22 -07:00
Tig
3ebc58e525 Merge pull request #4581 from tig/fix/4580_ListView 2026-01-23 21:03:12 -07:00
Tig
17bc5a8fc2 cleanup 2026-01-23 16:27:38 -07:00
Tig
3979c79371 cleanup and a TODO 2026-01-23 16:26:50 -07:00
Tig
f509de9f26 delted plan 2026-01-23 16:18:46 -07:00
Tig
5cc7e7dc51 Combobox->obsolete 2026-01-23 16:16:53 -07:00
Tig
ee4e89f1a7 Enable nullable refs, cleanup ListViewWithSelection & ComboBox
Refactored ListViewWithSelection.cs to enable nullable reference
types, updated field and event handler signatures, and improved
using directives. Cleaned up ComboBox.cs by removing redundant
event handler and clarifying Accepting logic. Improves null
safety, code clarity, and maintainability.
2026-01-23 16:14:55 -07:00
Tig
f4d36ad9a9 Refactor ListView selection/marking logic and tests
- Clarified and unified ListView selection and marking logic for all four ShowMarks/MarkMultiple combinations (standard, hidden marks, radio button, checkbox).
- Moved command and key/mouse binding setup to new SetupBindingsAndCommands method in ListView.Commands.cs.
- Refactored mouse and keyboard event handling to ensure correct marking/selection behavior for all input types and modes.
- Improved and documented marking methods (MarkUnmarkSelectedItem, MarkAll, UnmarkAll, UnmarkAllButSelected) with clear behavior for each mode.
- Updated and expanded unit tests, including new ListViewTests_Combinations.cs for comprehensive coverage of all combinations and transitions.
- Improved code organization, comments, and documentation throughout for maintainability and clarity.
- Result: more robust, predictable, and testable ListView selection/marking system.
2026-01-23 15:57:13 -07:00
Tig
dfcb576a61 Refactor ListView marking API: ShowMarks & MarkMultiple
Renamed AllowsMarking → ShowMarks and AllowsMultipleMarking → MarkMultiple for clarity. ShowMarks now controls mark glyph visibility; MarkMultiple controls checkbox vs radio button behavior. Updated all usages, docs, UI, and tests. Refactored drawing logic for all combinations. IListDataSource and related comments updated for new terminology. Improves API clarity and marking flexibility.
2026-01-23 13:18:40 -07:00
Tig
43e9af77c6 partial progress 2026-01-23 12:06:51 -07:00
Tig
d454374946 plan 2026-01-23 10:32:10 -07:00
Tig
376dc380ac Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-23 08:11:12 -07:00
Tig
fef282c8f3 Fixed #4617 - Synthesized mouse clicks are not including shift/ctrl keys 2026-01-22 15:37:12 -07:00
Tig
2296317fb8 Refactor ListView: partials, improved multi-select logic
Split ListView into partial classes for clarity and maintainability. Improved multi-selection and marking logic, ensuring marks reflect selection state and drawing highlights multi-selected items distinctly. Updated key/mouse bindings for robust multi-selection. No functional changes to IListDataSource or ListWrapper<T> beyond formatting. Sample scenario updated to match new logic.
2026-01-22 15:30:02 -07:00
Tig
004bfd200b Fixed shft selection bug. 2026-01-22 14:24:51 -07:00
Tig
a58f847fae deleted old docs 2026-01-22 13:56:10 -07:00
Tig
e547b117ae Add viewport overscroll flags and improve clamping logic
Introduce AllowXPlusWidthGreaterThanContentWidth, AllowYPlusHeightGreaterThanContentHeight, and AllowLocationPlusSizeGreaterThanContentSize flags to enable viewport overscroll and blank space beyond content. Update clamping logic in View to respect these flags. Refactor ViewportSettingsFlags enum for clarity. Enable overscroll by default in TextView. Update and expand tests to cover new behaviors and ensure backward compatibility.
2026-01-22 13:23:03 -07:00
Tig
3278bc088c Fixed customm scroll issue 2026-01-22 11:59:20 -07:00
Tig
1fcf055017 Merge branch 'fix/4580_ListView' of tig:tig/Terminal.Gui into fix/4580_ListView 2026-01-22 10:50:47 -07:00
Tig
69807861ec Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-22 10:50:35 -07:00
Tig
a8d19af804 Merge branch 'v2_develop' into fix/4580_ListView 2026-01-22 10:47:48 -07:00
Tig
30679ca6ca Merge branch 'gui-cs:v2_develop' into v2_develop 2026-01-22 10:41:27 -07:00
Tig
aba24a3bc5 Standardize IValue<T> interface across value-bearing Views (#4601)
* New workflow that will analyze the dmp file on the macos runner.

* Add IValue<T> implementation plan document

Documents the plan to standardize IValue<T> interface across all
value-bearing Views, including:
- Non-generic IValue interface for command propagation
- Classification of Views that should/shouldn't implement IValue<T>
- Phased implementation approach
- Testing strategy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add non-generic IValue interface

Phase 1 of IValue standardization:
- Add IValue interface with GetValue() method for boxed value access
- Update IValue<T> to inherit from IValue
- Add default implementation: IValue.GetValue() => Value
- Add unit tests for GetValue() and polymorphic usage

This enables command propagation to carry values without knowing
the generic type, supporting CommandContext.Value population.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* NumericUpDown implements IValue<T> with CWP events

- NumericUpDown<T> now implements IValue<T>
- Changed events from CancelEventArgs<T>/EventArgs<T> to
  ValueChangingEventArgs<T>/ValueChangedEventArgs<T>
- Added virtual OnValueChanging and OnValueChanged methods
- Updated UICatalog scenarios for new event signatures
  - Changed .Cancel to .Handled
  - Updated event handler type arguments

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Implement IValue on CheckBox, TextField, and SelectorBase

- CheckBox implements IValue with GetValue() returning CheckedState
- TextField implements IValue with GetValue() returning Text
- SelectorBase implements IValue with GetValue() returning Value (int?)
- OptionSelector<TEnum> overrides GetValue() to return typed enum value
- FlagSelector<TFlags> overrides GetValue() to return typed flags value
- Added unit tests for all IValue implementations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Implement IValue<T> on remaining value-bearing Views

- ScrollBar: IValue<int> mapping to Position
- DateField: IValue<DateTime?> mapping to Date
- TimeField: IValue<TimeSpan> mapping to Time
- DatePicker: IValue<DateTime> mapping to Date
- ListView: IValue<int?> mapping to SelectedItem
- CharMap: IValue<Rune> mapping to SelectedCodePoint

Also updates ValueChangedEventArgs usage from .Value to .NewValue
across UICatalog scenarios and tests.

Updates ivalue-implementation-plan.md with:
- Completion status for all implementations
- Detailed analysis of LinearRange<T> design challenges

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* cleanup

* revised

* 1. CheckBox - Removed CheckedState, CheckedStateChanging, CheckedStateChanged. Now uses Value, ValueChanging, ValueChanged.
  2. ScrollBar - Removed Position, PositionChanging, PositionChanged. Now uses Value, ValueChanging, ValueChanged.
  3. DateField - Removed Date, DateChanged. Now uses Value, ValueChanged.
  4. TimeField - Removed Time, TimeChanged. Now uses Value, ValueChanged.
  5. DatePicker - Removed Date property. Now uses Value.
  6. ListView - Removed SelectedItemChanged. Now uses ValueChanged. SelectedItem is kept as a semantic alias for Value.
  7. CharMap - Removed SelectedCodePointChanged. Now uses ValueChanged. SelectedCodePoint is kept as a semantic alias for Value.
  8. ColorPicker - Removed ColorChanged. Now uses ValueChanged. SelectedColor is kept as a semantic alias for Value.
  9. ColorPicker16 - Added IValue<ColorName16> implementation with Value, ValueChanging, ValueChanged.

  Files Updated Across Codebase

  - Examples: UICatalogRunnable.cs, TimeAndDate.cs, ScrollBarDemo.cs, CharacterMap.cs, Wizards.cs, Scrolling.cs, Themes.cs,
  TextInputControls.cs, PromptExample/Program.cs, and many scenario files
  - Tests: CheckBoxTests.cs, ScrollBarTests.cs, TimeFieldTests.cs, DateFieldTests.cs, DatePickerTests.cs, IValueTests.cs, and
  others

  Event Args Changes

  - CheckedStateChangingEventArgs → ValueChangingEventArgs<CheckState> with NewValue (not Result)
  - CheckedStateChangedEventArgs → ValueChangedEventArgs<CheckState> with NewValue (not Value)
  - Similar pattern for all other views

* Code cleanup

* fixed merge issues

* Fixed regression

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 10:41:17 -07:00
Tig
75a71c6280 reverted Generic.cs 2026-01-22 08:03:36 -07:00
Tig
8285826dc3 Fix horizontal scrollbar not showing with marks enabled
- Add MarkWidth and EffectiveMaxItemLength helper properties
- Update SetContentSize calls to use EffectiveMaxItemLength which includes
  mark columns (2) when AllowsMarking is true
- Update LeftItem clamping to use EffectiveMaxItemLength
- Update AllowsMarking setter to recalculate content size when changed
- Add 2 unit tests for mark width content size behavior

The horizontal scrollbar now correctly appears when viewport width is less
than (MaxItemLength + 2) when marks are enabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 07:40:27 -07:00
Tig
d038aa43f9 Fix scrolling offset clamping in ListView (Phase 7)
- Update LeftItem setter to clamp values to [0, MaxItemLength - Viewport.Width]
  instead of throwing ArgumentException for out-of-range values
- Update TopItem setter to clamp values to [0, Count - Viewport.Height]
  ensuring scrolling stops when last items are visible
- Add 4 new unit tests for clamping behavior
- Update existing LeftItem_TopItem_Tests to use smaller viewport to properly
  test scrolling with the new clamping behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 06:46:33 -07:00
Tig
433f0d2f87 Add custom mark rendering API to ListView (Phase 6)
- Add RenderMark method to IListDataSource interface with default
  implementation returning false
- Add virtual RenderMark method to ListWrapper<T> to allow subclass
  overrides via standard override keyword
- Update OnDrawingContent to call Source.RenderMark() before default
  mark rendering, allowing custom data sources to handle marks
- Add 3 unit tests for RenderMark functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 06:41:19 -07:00
Tig
53ac5c4510 Fix mark rendering to use Normal attribute (Phase 5)
- Marks ([x]/[ ]) now render with VisualRole.Normal attribute
- Provides visual clarity by keeping marks consistent across selection states
- Save/restore attribute around mark rendering
- Add 2 new unit tests for mark rendering behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 06:12:58 -07:00
Tig
288895ffd0 Add multi-selection rendering to ListView (Phase 4)
- Update OnDrawingContent to use VisualRole.Highlight for multi-selected items
- VisualRole.Focus for focused SelectedItem (cursor position)
- VisualRole.Highlight for items in MultiSelectedItems
- VisualRole.Active for SelectedItem without focus
- Update AllowsMultipleSelection setter to clear MultiSelectedItems
- Add 4 new unit tests for rendering behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 06:10:07 -07:00
Tig
f80c9fa33d Add Shift+Click and Ctrl+Click multi-selection to ListView (Phase 3)
- Shift+Click extends selection from anchor to clicked item
- Ctrl+Click toggles individual items in multi-selection
- Normal click clears multi-selection and selects single item
- Add mouse bindings for modifier combinations (overrides base View)
- Add 5 new unit tests for mouse modifier behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 06:06:12 -07:00
Tig
e73f176b47 Add Shift+Arrow extend selection support to ListView (Phase 2)
- Update MoveUp/Down/PageUp/PageDown/Home/End methods with extend parameter
- Add Command.UpExtend, DownExtend, PageUpExtend, PageDownExtend,
  StartExtend, EndExtend handlers
- Add Shift+Arrow/Page/Home/End key bindings for extend commands
- Add 12 new unit tests for extend functionality
- Fix existing test to use Ctrl+D instead of Shift+Down (now bound)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 05:59:40 -07:00
Tig
a08cfeb31a Add phase progress table to ListView implementation plan
Added a clear progress tracking table at the top of the plan document
showing all 8 phases with their current status:
- Phase 0:  COMPLETED
- Phase 1:  COMPLETED (already implemented)
- Phases 2-7:  PENDING

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:50:14 -07:00