Fixes #4050. Rename Command.Select and Selecting to Activate/Activating (#4470)

* Initial plan

* Rename Command.Select to Command.Activate and Selecting to Activating

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

* Add Activating event propagation to SuperView

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

* Update all comments and docs referencing Select to Activate

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

* Fix event log messages in examples to use Activating/Activate

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

* Revert automatic Activating event propagation that broke tests

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

* Update docfx documentation to use Activate/Activating terminology

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

* renames

* Revert "Add Activating event propagation to SuperView"

This reverts commit 6d82bee9ad.

* added command diagrams

* mermaid

* updated level 3

* again

* Select->Activate in MouseTests.cs

* Update Terminal.Gui/Views/Selectors/FlagSelector.cs

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

* Refactor: Rename Selecting to Activating in View APIs

Renamed the `Selecting` event and `OnSelecting` method to
`Activating` and `OnActivating` to better reflect their purpose.
Updated all related comments, test method names, variables,
and assertions in `View` and `ViewCommandTests` to align with
the new terminology.

Improved code clarity by using `_` for unused parameters in
lambda expressions. Renamed properties like `HandleSelecting`
to `HandleActivating` and adjusted naming conventions for
consistency (e.g., `OnactivatingCount` to `OnActivatingCount`).

These changes enhance readability, maintainability, and
terminology consistency across the codebase.

* Update Terminal.Gui/Views/Selectors/OptionSelector.cs

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

* Typos

---------

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>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-09 12:42:34 -07:00
committed by GitHub
parent b2cf674e0b
commit e7a4df492d
57 changed files with 512 additions and 390 deletions

View File

@@ -146,15 +146,15 @@ public class AllViewsTests (ITestOutputHelper output) : TestsAllViews
designable.EnableForDesign ();
}
var selectingCount = 0;
view.Selecting += (s, e) => selectingCount++;
var activatingCount = 0;
view.Activating += (s, e) => activatingCount++;
var acceptedCount = 0;
view.Accepting += (s, e) => { acceptedCount++; };
if (view.InvokeCommand (Command.Select) == true)
if (view.InvokeCommand (Command.Activate) == true)
{
Assert.Equal (1, selectingCount);
Assert.Equal (1, activatingCount);
Assert.Equal (0, acceptedCount);
}
view?.Dispose ();
@@ -178,15 +178,15 @@ public class AllViewsTests (ITestOutputHelper output) : TestsAllViews
designable.EnableForDesign ();
}
var selectingCount = 0;
view.Selecting += (s, e) => selectingCount++;
var activatingCount = 0;
view.Activating += (s, e) => activatingCount++;
var acceptingCount = 0;
view.Accepting += (s, e) => { acceptingCount++; };
if (view.InvokeCommand (Command.Accept) == true)
{
Assert.Equal (0, selectingCount);
Assert.Equal (0, activatingCount);
Assert.Equal (1, acceptingCount);
}
view?.Dispose ();

View File

@@ -22,7 +22,7 @@ public class CheckBoxTests ()
ckb.CheckedStateChanging += (s, e) => checkedStateChangingCount++;
var selectCount = 0;
ckb.Selecting += (s, e) => selectCount++;
ckb.Activating += (s, e) => selectCount++;
var acceptCount = 0;
ckb.Accepting += (s, e) => acceptCount++;
@@ -250,7 +250,7 @@ public class CheckBoxTests ()
checkBox.CheckedStateChanging += (s, e) => checkedStateChangingCount++;
var selectCount = 0;
checkBox.Selecting += (s, e) => selectCount++;
checkBox.Activating += (s, e) => selectCount++;
var acceptCount = 0;
checkBox.Accepting += (s, e) => acceptCount++;
@@ -292,7 +292,7 @@ public class CheckBoxTests ()
checkBox.CheckedStateChanging += (s, e) => checkedStateChangingCount++;
var selectCount = 0;
checkBox.Selecting += (s, e) => selectCount++;
checkBox.Activating += (s, e) => selectCount++;
var acceptCount = 0;

View File

@@ -484,7 +484,7 @@ public class ShortcutTests
};
var selected = 0;
shortcut.Selecting += (s, e) => selected++;
shortcut.Activating += (s, e) => selected++;
app.Keyboard.RaiseKeyDownEvent (key);

View File

@@ -49,7 +49,7 @@ public class TextFieldTests (ITestOutputHelper output) : FakeDriverBase
{
TextField tf = new ();
tf.Selecting += (sender, args) => Assert.Fail ("Selected should not be raied.");
tf.Activating += (sender, args) => Assert.Fail ("Activating should not be raised.");
Runnable top = new ();
top.Add (tf);
@@ -64,15 +64,15 @@ public class TextFieldTests (ITestOutputHelper output) : FakeDriverBase
{
TextField tf = new ();
var selectingCount = 0;
tf.Selecting += (sender, args) => selectingCount++;
var activatingCount = 0;
tf.Activating += (sender, args) => activatingCount++;
Runnable top = new ();
top.Add (tf);
tf.SetFocus ();
top.NewKeyDownEvent (Key.Enter);
Assert.Equal (0, selectingCount);
Assert.Equal (0, activatingCount);
top.Dispose ();
}