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

@@ -134,7 +134,7 @@ public class CharacterMap : Scenario
_categoryList.Table = CreateCategoryTable (0, isDescending);
// if user clicks the mouse in TableView
_categoryList.Selecting += (_, e) =>
_categoryList.Activating += (_, e) =>
{
// Only handle mouse clicks
if (e.Context is not CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })

View File

@@ -35,7 +35,7 @@ public class ContextMenus : Scenario
Application.Run (_appWindow);
_appWindow.Dispose ();
_appWindow.KeyDown -= OnAppWindowOnKeyDown;
_appWindow.Selecting -= OnAppWindowOnSelecting;
_appWindow.Activating -= OnAppWindowOnActivating;
_winContextMenu?.Dispose ();
// Shutdown - Calling Application.Shutdown is required.
@@ -81,7 +81,7 @@ public class ContextMenus : Scenario
_appWindow.Add (_tfBottomRight);
_appWindow.KeyDown += OnAppWindowOnKeyDown;
_appWindow.Selecting += OnAppWindowOnSelecting;
_appWindow.Activating += OnAppWindowOnActivating;
CultureInfo originalCulture = Thread.CurrentThread.CurrentUICulture;
_appWindow.IsRunningChanged += (_, e) => {
@@ -91,7 +91,7 @@ public class ContextMenus : Scenario
} };
}
void OnAppWindowOnSelecting (object? s, CommandEventArgs e)
void OnAppWindowOnActivating (object? s, CommandEventArgs e)
{
if (e.Context is CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
{

View File

@@ -81,7 +81,7 @@ public class EventLog : ListView
_viewToLog.MouseWheel += (_, args) => { Log ($"MouseWheel: {args}"); };
_viewToLog.HandlingHotKey += (_, args) => { Log ($"HandlingHotKey: {args.Context}"); };
_viewToLog.Selecting += (_, args) => { Log ($"Selecting: {args.Context}"); };
_viewToLog.Activating += (_, args) => { Log ($"Activating: {args.Context}"); };
_viewToLog.Accepting += (_, args) => { Log ($"Accepting: {args.Context}"); };
}
}

View File

@@ -105,7 +105,7 @@ public class ListViewWithSelection : Scenario
_listView.OpenSelectedItem += (s, a) => LogEvent (s as View, a, "OpenSelectedItem");
_listView.CollectionChanged += (s, a) => LogEvent (s as View, a, "CollectionChanged");
_listView.Accepting += (s, a) => LogEvent (s as View, a, "Accept");
_listView.Selecting += (s, a) => LogEvent (s as View, a, "Select");
_listView.Activating += (s, a) => LogEvent (s as View, a, "Activate");
_listView.VerticalScrollBar.AutoShow = true;
_listView.HorizontalScrollBar.AutoShow = true;

View File

@@ -425,7 +425,7 @@ public class Shortcuts : Scenario
BoxWidth = 1
};
bgColorShortcut.Selecting += (o, args) =>
bgColorShortcut.Activating += (o, args) =>
{
//args.Cancel = true;
};
@@ -480,18 +480,18 @@ public class Shortcuts : Scenario
foreach (Shortcut shortcut in Application.TopRunnableView.SubViews.OfType<Shortcut> ())
{
shortcut.Selecting += (o, args) =>
shortcut.Activating += (o, args) =>
{
if (args.Handled)
{
return;
}
eventSource.Add ($"{shortcut!.Id}.Selecting: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}");
eventSource.Add ($"{shortcut!.Id}.Activating: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}");
eventLog.MoveDown ();
};
shortcut.CommandView.Selecting += (o, args) =>
shortcut.CommandView.Activating += (o, args) =>
{
if (args.Handled)
{
@@ -499,7 +499,7 @@ public class Shortcuts : Scenario
}
eventSource.Add (
$"{shortcut!.Id}.CommandView.Selecting: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}");
$"{shortcut!.Id}.CommandView.Activating: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}");
eventLog.MoveDown ();
//args.Handled = true;
};

View File

@@ -610,7 +610,7 @@ public class TableEditor : Scenario
};
// if user clicks the mouse in TableView
_tableView!.Selecting += (s, e) =>
_tableView!.Activating += (s, e) =>
{
if (_currentTable == null)
{

View File

@@ -60,7 +60,7 @@ public class TreeViewFileSystem : Scenario
};
win.Add (_detailsFrame);
_treeViewFiles.Selecting += TreeViewFiles_Selecting;
_treeViewFiles.Activating += TreeViewFiles_Selecting;
_treeViewFiles.KeyDown += TreeViewFiles_KeyPress;
_treeViewFiles.SelectionChanged += TreeViewFiles_SelectionChanged;

View File

@@ -86,7 +86,7 @@ public class ViewExperiments : Scenario
//App?.Popover!.Visible = true;
}
testFrame.Selecting += (sender, e) =>
testFrame.Activating += (sender, e) =>
{
if (e.Context is CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
{