Skip to content

Fixes #4107 - Revamps Terminal.Gui's namespace#4109

Merged
tig merged 59 commits into
tui-cs:v2_developfrom
tig:v2_4107-Namespace
May 31, 2025
Merged

Fixes #4107 - Revamps Terminal.Gui's namespace#4109
tig merged 59 commits into
tui-cs:v2_developfrom
tig:v2_4107-Namespace

Conversation

@tig

@tig tig commented May 30, 2025

Copy link
Copy Markdown
Member

TODO

  • Decide on correct structure
  • Update all projects
  • Fix API documentation

msedge_egkc05mS9A

tig and others added 30 commits March 6, 2025 11:42
* Add W3C color enum with the RGB as numeric value

* Add transform helper class for W3cColor enum

For the sake of backwards compatibility prioritize parsing 16 color mode color names over the W3C colors because the previous resource-based color names/values had a mix of W3C and 16 color mode RGB values.

Mechanism for choosing/prioritizing one color scheme over the other is currently only available at higher application/driver/output level.

* IColorNameResolver enable null analysis

* Remove obsolete color name related ResourceManagerTests

* Replace remains of W3CColors with direct W3C color name resolver

Temporarily breaks backwards compatibility and tests even further.

* Add ANSI 4-bit (ColorName16) color name resolver

* Add multi-standard color name resolver

Combined resolver for both ANSI 4-bit (ColorName16) and W3C colors while trying to maintain backwards compatibility for ColorPicker.

* Split conditional name resolver test cases

* Change W3C colors tests to be similar to name resolvers

* Change W3cColorsTests to W3cColorNameResolverTests

More consistent when all the tests refer to the color name resolver layer.

* Make W3cColors internal

Color name resolver is the public interface.

* W3cColors: Use Color.Argb instead of individual RGB components

* MultiStandardColorNameResolver: Substitute instead of blocking alternative W3C names

Changes color picker behavior a bit, e.g. Aqua will match to Cyan instead of jumping to Aquamarine.

* Remove leftover color string resources

* Consistent position for IColorNameResolver #nullable enable directive

* Add missing XML comments to ColorScheme.Colors.cs
* Added Applicaton.Popover.
Refactored FindDeepestView

* Popover prototype

* Testing highlight

* Fixed click outside issue

* Fixed DialogTests

* Fixed click outside issue (agbain)

* Enabled mouse wheel in Bar

* Enabled mouse wheel in Bar

* Progress. Broke arrangement

* Added popover tests.
Fixed a bunch more CM issues related ot unreliable unit tests.
Updated config.json to include Glyphs.

* Can't set ForceDriver to empty in Resources/config.json.

* added BUGBUG

* Made Position/ScreenPosition clear

* Added View.IsInHierarchy tests

* Added Contextmenuv2 scenario.

* Implemented CM2 in TextView

* Removed unneeded CM stuff from testhelpers

* Shortcut API docs

* Fixed keybinding unit tests

* Fixed mouse handling

* Fighting with CM related unit test failures

* Unit tests pass. I think.

* Shortcut code cleanup

* TextView uses new CM2

* Starting on OnSelect etc...

* Starting on OnSelect etc...

* Fixed ContextMenuv2

* ContextMenu is working again.

* Ugh. ANd fixed button api docs

* Fixed DrawHorizontalShadowTransparent (vertical was already fixed).

* Made Scenarios compatible with #nullable enable

* Undid some keybinding stuff

* Fixed stuff

* Sped up unit tests

* Sped up unit tests 2

* Sped up unit tests 3

* Messing with menus

* merged latest v2_develop

* Added more Popover unit tests

* Added more Popover unit tests2

* Fixed positioning bug

* Fixed mouse bug

* Fixed Bar draw issue

* WIP

* merge v2_develop

* CM2 sorta works

* Enabled Bar subclasses to have IDesignable

* Added ViewportSettings.Transparent

* Region -> nullable enable

* Added ViewportSettigs Editor

* merged v2_develop part 2

* merged v2_develop part 3

* WIP: GetViewsUnderMouse

* WIP: More GetViewsUnderMouse work

* Bars works again

* Added unit tests

* CM now works

* MenuItemv2 POC

* SubMenu POC

* CommandNotBound

* More POC

* Optimize Margin to not defer draw if there's no shadow

* Logger cleanup

* Reverted Generic

* Cascading mostly working

* fixed layout bug

* API docs

* API docs

* Fixed cascade

* Events basically work

* code cleanup

* Fixed IsDefault bug;

* Enabled hotkey support

* Made context-menu-like

* Improved usability

* Refactored ApplicationPopover again

* Cleanup

* Menuv2 POC basically complete

* Code Cleanup

* Made menu API simpler

* Fixed Strings bugs

* Got old ContextMenu scenario mostly working

* ContextMenu scenario now works

* ContextMenu fixes

* ContextMenu fixes

* Tons of menu cleanup

* ContextMenu works in TextView

* Fixed unit tes

* Added unit tests

* Fixed tests

* code cleanup

* More code cleanup

* Deep dive

* scenario

* typos

* Demo colorpicker in a Menu

* Added Region tests proving Region is broken in some Union cases

* fixed v2win/net
…r/Shortcut` based implementation (tui-cs#4008)

* touching publish.yml

* Nuked ContextMenuv2 - use PopverMenu instead

* WIP context menu stuff

* More robust dispose

* Removed ConextMenu; use PopoverMenu instead

* Code cleanup

* Code cleanup2
…cs#4024)

* Add class for detecting information about console in extensible way

* WIP - Create test for reordering

* Change Dictionary to List and preserve TreeBuilder order

* Add test to ensure branch expansion/status remains consistent despite reorder

* Cleanup code

* Fix regression when removed child was the selected one

* Revert "Add class for detecting information about console in extensible way"

This reverts commit 7e4253c.

* Code cleanup and enable nullable on Branch

* Remove color scheme and driver from Branch draw

* Add xunit context extensions

* Investigate codegen for xunit

* Getting closer to something that works

* Fix code generation

* Further explore code gen

* Generate all methods in single class for easier extensibility

* Simplify code gen by moving parameter creation to its own method

* Implement asserts A-I

* Add remaining assert calls that are not obsolete

* Fix unit test

* Roll back versions to be compatible with CI version of csharp

* Handle params and ref etc

* Fix null warning

* WIP - start to add integration tests for FileDialog

* Add ability to tab focus to specific control with simple one line delegate

* Clarify test criteria

* Add unit tests for Ok and other ways of canceling dialog

* Fix other buttons also triggering save

* Fix for linux environment tests

* Fix for linux again

* Fix application null race condition - add better way of knowing if stuff is finished

* Better fix for shutdown detection

* Add test that shows tui-cs#4026 is not an issue

* Switch to `_fileSystem.Directory.GetLogicalDrives ()`

* Don't show duplicate MyDocuments etc
…-cs#4040)

* touching publish.yml

* Fixed UICatalog bugs. Added fluent tests.

* marked v1 menu stuff as obsolte

* Tweaks.
Added View.GetSubMenus<type>().

* fixed unit tests

* general messing around

* general messing around

* Playing with Fluent

* ColorScheme tweaks

* WIP: ColorScheme tweaks

* Playing with Fluent

* Merged from laptop2

* Hacky-ish fixes to:
- tui-cs#4016
- tui-cs#4014

* Fixed Region bug preventing menus without borders from working

* Tweaks

* Fixed a bunch of CM issues

* Fixed OoptionSelector

* ip

* FixedCM issues

* Fixed CM issues2

* Revert "FixedCM issues"

This reverts commit dd6c6a7.

* Reverted stuff

* Found and fixed bug in AllViews_Center_Properly

* Fixed CM issues2

* removed menuv2 onapplied.
Changed how UICatalog Applys CM

* changed test time out to see if it helkps with ubuntu fails

* reset app on fail?

* back to 1500ms

* Made StatusBar nullable.

* Code Cleanup.

* HexEditor Code Cleanup.

* HexEditor Code Cleanup.

* Back to 3000ms. Sigh.

* Trying different logic

* Trying different logic2

* Fixed potential crash in runlop

* Fixed potential crash in runlop2

* Tweaked Spinner stuff

* Removed TabView from TextEffects scenario. Not needed and possible culprit.

* back to 2000ms

* WIP: Revamping menu scenarios

* Menu Scenario refinements.
Fixed a few bugs.
Code cleanup.

* fixed unit test

* Fixed warnings

* Fixed warnings2

* Fixed File.Exit

* WIP: Dealing with QuitKey struggles

* WIP: Dealing with QuitKey struggles 2

* WIP: Dealing with QuitKey struggles 3

* Fixed ListView collection nav bug

* Fixed a bunch of menu stuff.
Fixed Appv2 stuff.

* Lots of refactoring and fixing

* Lots of unit test issues

* Fixed DebugIDisposable issues

* Fixed release build issue

* Fixed release build issue 2

* DebugIDisposable -> EnableDebugIDisposableAsserts and more

* DebugIDisposable -> EnableDebugIDisposableAsserts and more 2

* Fixed Menus scenario - context menu

* Added @BDisp suggested assert. Commented it out as it breaks tests.

* Code cleanup

* Fixed disposed but

* Fixed UICatalog exit

* Fixed Unit test I broke.
Added 'Minimal' Theme that turns off all borders etc...
…te pair (tui-cs#3982)

* Add constructor Key(int) and operator for handled with non-Bmp.

* Fix TextField non-BMP issues

* Fix TextField PositionCursor.

* Reformat

* Add IsValidInput method to handle clipboard paste when pressing CTRL+V in WT

* Add handle IsValidInput in FakeDriver and unit tests

* Fixes tui-cs#3984 - `Margin` w/out shadow should not force draw (tui-cs#3985)

* shortcut tests

* Generic demos

* Optimize Margin to not defer draw if there's no shadow

* Fixes tui-cs#4041. WSLClipboard doesn't handles well with surrogate pairs

* Avoid running Clipboard.Contents twice

* Fixes tui-cs#4042. Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Could not find testhost

* Moving tests to the parallelizable unit tests

* Remove unused folder

* Prevent warnings about not installed nuget packages

* Using Toplevel instead of Application.Top

* Cleanup code

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
* touching publish.yml

* WIP Investigate how to build random maze

* Fix maze rendering

* Use line canvas for rendering

* Move around the maze

* Code cleanup

* Infinite maze

* Fight goblins

* Generate new npcs on new maps

* Code cleanup

* Make it possible to die

* Fix variable naming

* Refactored Mazing to use Commmands and KeyBindings.
Code cleanup of Mazing.
Refactored Snake to use KeyBindings/Commmands + some code cleanup

* Fix bug where your health would regenerate when reaching end making it impossible to loose.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
…ts` (tui-cs#4047)

* touching publish.yml

* Moved Examples into ./Examples

* Moved Benchmarks into ./Tests

* Moved Benchmarks into ./Tests

* Moved UICatalog into ./Examples

* Moved UICatalog into ./Examples 2

* Moved tests into ./Tests

* Updated nuget
* Add collection search matcher

* Fix naming

* fix naming

* Move FileDialogCollectionNavigator to its own file (no longer private class)
Add class diagram for collectionNavigation

* Add ICollectionNavigator interface

* Move to separate file IListCollectionNavigator

* Update class diagram

* update class diagram

* Add tests for overriding ICollectionNavigatorMatcher

* xmldoc and nullability warning fixes

* Code Cleanup

* Make requested changes to naming and terminology

* Move to seperate namespace

* Update class diagram and change TreeView to reference the interface not concrete class

* Switch to implicit new

* highlight that this class also works with tree view

* Apply tig patch to ensure keybindings get priority over navigator

See: tui-cs#4027 (comment)

* Apply 'keybinding has priority' fix to TreeView too

* Apply 'keybindngs priority over navigation' fix to TableView

* Remove entire branch for selectively returning false now that it is default when there is a keybinding collision

* Make classes internal and remove 'custom' navigator that was configured in UICatlaogToplevel

* Change logging in collection navigator from Trace to Debug

* Switch to NewKeyDownEvent and directly setting HasFocus

* Remove application top dependency

* Remove references to application

* Remove Application

* Move new tests to parallel

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
* touching publish.yml

* Updated md files

* Updated md files 2

* Updated md files 3

* Updated API docs to point

* commmand->command

* Update Terminal.Gui/View/View.Command.cs

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…onally) (tui-cs#4065)

* WIP keep path

* Make new 'sticky filename' behaviour optional

* Tests for new behaviour when selecting in TreeView

* Add more tests, this time for table view navigation

* Add the new style option into UICatalog scenario
Allow hotkey specifier to be at any position in label

"D_irectory" doesn't work because hotPos is hardcoded 0
…io in the UICatalog with cmd or conhost (tui-cs#4055)

* Fix WindowsDriver to work with non-WindowsTerminal

* Fix unit test failure

* Fix v2win to work with non-WindowsTerminal

* Force16Colors isn't being setting in v2win driver on changing.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
…dEventArgs` instead of `CancelEventArgs` (tui-cs#4054)

* touching publish.yml

* CancelEventArgs->HandledEventArgs

* Fixed Handled issues
* Add test for TextField cursor position

* Add comment and one more assert

* Fix cursor position at the end

* Remove unused local field

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
* touching publish.yml

* Added unit tests.
Fixed

* Actually fixed bug.

* Addres Bdisp feedback

* Addres Bdisp feedback2
…cs#4071)

* TextStyle enum

* CSI_AppendTextStyleChange

* Add TextStyle to Attribute

* Apply text style in NetOutput.Write()

* Don't append escape code if nothing to change

* Make TextStyle an init property

* Apply TextStyle to OutputBuffer attributes

* Fix flag checking

Misunderstood how Enum.HasFlag worked, fixed now

* Allow bold-faint text

Also adds remarks to TextStyle noting that they may be incompatible depending on terminal settings.

* Remove unnecessary check

Realized it's actually impossible for no escape codes to be added, as this is only the case when prev and next are the same, which is already accounted for.

* Remove redundant check

Attributes are records, and thus already use equality-by-value, meaning attr != redrawAttr will already be false when the TextStyle changes.

* WindowsOutput support for text style

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
* Fixed Generic.cs.
Added TextStyles Scenario.

* Code cleanup
* touching publish.yml

* Fixed api docs
@tig

tig commented May 31, 2025

Copy link
Copy Markdown
Member Author

This is fun. I wrote a script that parses the API doc data and feeds it to a Terminal Gui app that takes the name of a View on the commandline and uses Application.ToString() to output it. The new views.md:

Views

Terminal.Gui provides a rich set of views and controls for building terminal user interfaces:

Bar

Provides a horizontally or vertically oriented container for Shortcuts to be used as a menu, toolbar, or status bar.

Quit  Quit  Ctrl+Z  Help  Help Text  F1  ☐ Check

Button

A button View that can be pressed with the mouse or keyboard.

⟦ Button ⟧

CharMap

A scrollable map of the Unicode codepoints.

0  1  2  3  4  5  6  7  8  9  a  b  c  d
U+00000_                                         ▲
U+00001_                                         █
U+00002_    !  "  #  $  %  &  '  (  )  *  +  ,  -░
U+00003_ 0  1  2  3  4  5  6  7  8  9  :  ;  <  =░
U+00004_ @  A  B  C  D  E  F  G  H  I  J  K  L  M░
U+00005_ P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]░
U+00006_ `  a  b  c  d  e  f  g  h  i  j  k  l  m░
U+00007_ p  q  r  s  t  u  v  w  x  y  z  {  |  }░
U+00008_                                         ░
U+00009_                                         ░
U+0000a_    ¡  ¢  £  ¤  ¥  ¦  §  ¨  ©  ª  «  ¬  ­░
U+0000b_ °  ±  ²  ³  ´  µ  ¶  ·  ¸  ¹  º  »  ¼  ½░
U+0000c_ À  Á    à  Ä  Å  Æ  Ç  È  É  Ê  Ë  Ì  Í░
U+0000d_ Ð  Ñ  Ò  Ó  Ô  Õ  Ö  ×  Ø  Ù  Ú  Û  Ü  Ý░
U+0000e_ à  á  â  ã  ä  å  æ  ç  è  é  ê  ë  ì  í░
U+0000f_ ð  ñ  ò  ó  ô  õ  ö  ÷  ø  ù  ú  û  ü  ý░
U+00010_ Ā  ā  Ă  ă  Ą  ą  Ć  ć  Ĉ  ĉ  Ċ  ċ  Č  č░
U+00011_ Đ  đ  Ē  ē  Ĕ  ĕ  Ė  ė  Ę  ę  Ě  ě  Ĝ  ĝ▼
        ◄█████████████████████████████████░░░░░░►

CheckBox

Shows a checkbox that can be cycled between two or three states.

☐ Demo Title

ColorPicker

True color picker using HSL

H:                         ▲355
S:                  ▲       70
V:                       ▲  91
Hex:#E74856  ■

ColorPicker16

The OG 16-color color picker.

┌┄┄┐
└┄┄┘

ComboBox

Provides a drop-down list of items the user can select from.

DateField

Simple Date editing View

01/01/0001

DatePicker

The DatePicker View Date Picker.

┌┤Demo Title├────────────────┐
│Date:  05/30/2025           │
│┌───┬───┬───┬───┬───┬───┬──┐│
││Sun│Mon│Tue│Wed│Thu│Fri│Sa││
│├───┼───┼───┼───┼───┼───┼──┤│
││-  │-  │-  │-  │1  │2  │3 ││
││4  │5  │6  │7  │8  │9  │10││
││11 │12 │13 │14 │15 │16 │17││
││18 │19 │20 │21 │22 │23 │24││
││25 │26 │27 │28 │29 │30 │31││
││-  │-  │-  │-  │-  │-  │- ││
│└───┴───┴───┴───┴───┴───┴──┘│
│           ◄◄  ►►           │
└────────────────────────────┘

Dialog

The Dialog View is a Window that by default is centered and contains one or more Buttons. It defaults to the Colors.Schemes ["Dialog"] scheme and has a 1 cell padding around the edges.

┏┥Demo Title┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃Demo Text                               ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┃                                        ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

FileDialog

Modal dialog for selecting files/directories. Has auto-complete and expandable navigation pane (Recent, Root drives etc).

┏┥Open┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃C:\Users\Tig\s\gui-cs\Terminal.Gui\doc┃
┃⟦▲⟧                                   ┃
┃┌────────────────────┬───────────────┐┃
┃│Filename (▲)        │Size           │┃
┃├────────────────────┼───────────────►┃
┃│..                  │               │┃
┃│\_exported_templates│               │┃
┃│\_site              │               │┃
┃│\api                │               │┃
┃│\docs               │               │┃
┃│\images             │               │┃
┃│\schemas            │               │┃
┃│\scripts            │               │┃
┃⟦ ►► ⟧ Enter Search⟦► OK ◄⟧ ⟦ Cancel ⟧┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

FlagSelector

Provides a user interface for displaying and selecting flags. Flags can be set from a dictionary or directly from an enum type.

☒ No Style
☐ Show None Value Style
☐ Show Value Editor Style
☐ All Styles
0

FlagSelector<T>

Provides a user interface for displaying and selecting flags. Flags can be set from a dictionary or directly from an enum type.

FrameView

A non-overlapped container for other views with a border and optional title.

╭┤Demo Title├────────────────────────────────────╮
│Demo Text                                       │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
╰────────────────────────────────────────────────╯

GraphView

View for rendering graphs (bar, scatter, etc.).

│        .
                            │      ..
                        0.60┤     .
                            ┤    ∙
                            │   .
                            │ ..
                        0.20┤.
   ┬────┬────┬────┬────┬────∙────┬────┬────┬────┬─
 -2.50     -1.50     -0.50 .│  0.50      1.50
↑                         . │
Y                      -0.20┤
..                      .   │
  .                    ∙    ┤
   ∙                  .     │
    .               .. -0.60┤
     ..            .        │
       .        ..∙         ┤
        ∙....∙..       -1.00┤

                        X →

HexView

Hex viewer and editor View over a IO.Stream

00000000 48 65 78 56 ┊ 69 65 77 20  HexView
00000008 64 61 74 61 ┊ 20 77 69 74  data wit
00000010 68 20 77 69 ┊ 64 65 20 63  h wide c
00000018 6f 64 65 70 ┊ 6f 69 6e 74  odepoint
00000020 73 3a 20 f0 ┊ 9d 94 b9 41  s: ����A
00000028 e2 84 9d f0 ┊ 9d 94 bd 21  �������!
00000030             ┊
00000038             ┊
00000040             ┊
00000048             ┊
00000050             ┊
00000058             ┊
00000060             ┊
00000068             ┊
00000070             ┊
00000078             ┊
00000080             ┊
00000088             ┊
00000090             ┊
00000098             ┊

Label

The Label View displays text that describes the View next in the View.SubViews. When Label receives a Command.HotKey command it will pass it to the next View in View.SubViews.

Label

LegendAnnotation

A box containing symbol definitions e.g. meanings for colors in a graph. The 'Key' to the graph

┌┤Demo Title├────────────────────────────────────┐
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
└────────────────────────────────────────────────┘

Line

Draws a single line using the LineStyle specified by View.BorderStyle.

──────────────────────────────────────────────────

LineView

A straight line control either horizontal or vertical

──────────────────────────────────────────────────

ListView

ListView View renders a scrollable list of data where each item can be activated to perform an action.

List Item 1
List Item two
List Item Quattro
Last List Item

MenuBar

Provides a menu bar that spans the top of a Toplevel View with drop-down and cascading menus. By default, any sub-sub-menus (sub-menus of the MenuItems added to MenuBarItems) are displayed in a cascading manner, where each sub-sub-menu pops out of the sub-menu frame (either to the right or left, depending on where the sub-menu is relative to the edge of the screen). By setting MenuBar.UseSubMenusSingleFrame to true, this behavior can be changed such that all sub-sub-menus are drawn within a single frame below the MenuBar.

File  Edit  About (Top-Level)

MenuBarItemv2

A Shortcut-derived object to be used as items in a MenuBarv2. MenuBarItems hold a MenuBarItemv2.PopoverMenu instead of a MenuBarItemv2.SubMenu.

Shortcut  Shortcut help  F1

MenuBarv2

A horizontal list of MenuBarItemv2s. Each MenuBarItemv2 can have a PopoverMenu that is shown when the MenuBarItemv2 is selected.

File  Edit  Help

MenuItemv2

A Shortcut-derived object to be used as a menu item in a Menuv2. Has title, an A Shortcut-derived object to be used as a menu item in a Menuv2. Has title, an associated help text, and an action to execute on activation.

Shortcut  Shortcut help  F1

Menuv2

A Bar-derived object to be used as a vertically-oriented menu. Each subview is a MenuItemv2.

┌─────────────────────────┐
│ Quit       Quit  Ctrl+Z │
│ Help  Help Text      F1 │
│ ☐ Check   Czech      F9 │
└─────────────────────────┘

NumericUpDown

Enables the user to increase or decrease an int by clicking on the up or down buttons.

▼0▲

NumericUpDown<T>

Enables the user to increase or decrease a value with the mouse or keyboard in type-safe way.

OpenDialog

The OpenDialogprovides an interactive dialog box for users to select files or directories.

┏┥Open┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃C:\Users\Tig\s\gui-cs\Terminal.Gui\doc┃
┃⟦▲⟧                                   ┃
┃┌────────────────────┬───────────────┐┃
┃│Filename (▲)        │Size           │┃
┃├────────────────────┼───────────────►┃
┃│..                  │               │┃
┃│\_exported_templates│               │┃
┃│\_site              │               │┃
┃│\api                │               │┃
┃│\docs               │               │┃
┃│\images             │               │┃
┃│\schemas            │               │┃
┃│\scripts            │               │┃
┃⟦ ►► ⟧ Enter Search⟦► OK ◄⟧ ⟦ Cancel ⟧┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

OptionSelector

Provides a user interface for displaying and selecting a single item from a list of options. Each option is represented by a checkbox, but only one can be selected at a time.

○ Option 1
○ Option 2
○ Option 3

PopoverMenu

Provides a cascading menu that pops over all other content. Can be used as a context menu or a drop-down all other content. Can be used as a context menu or a drop-down menu as part of MenuBarv2 as part of MenuBarv2.

ProgressBar

A Progress Bar view that can indicate progress of an activity visually.

▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌

RadioGroup

Displays a list of mutually-exclusive items. Each items can have its own hotkey.

◉ Option 1
○ Option 2
○ Option 3

SaveDialog

The SaveDialog provides an interactive dialog box for users to pick a file to save.

┏┥Save┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃C:\Users\Tig\s\gui-cs\Terminal.Gui\doc┃
┃⟦▲⟧                                   ┃
┃┌────────────────────┬───────────────┐┃
┃│Filename (▲)        │Size           │┃
┃├────────────────────┼───────────────►┃
┃│..                  │               │┃
┃│\_exported_templates│               │┃
┃│\_site              │               │┃
┃│\api                │               │┃
┃│\docs               │               │┃
┃│\images             │               │┃
┃│\schemas            │               │┃
┃│\scripts            │               │┃
┃⟦ ►► ⟧ Enter Sear⟦► Save ◄⟧ ⟦ Cancel ⟧┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

ScrollBar

Indicates the size of scrollable content and controls the position of the visible content, either vertically or horizontally. Two Buttons are provided, one to scroll up or left and one to scroll down or right. Between the buttons is a ScrollSlider that can be dragged to control the position of the visible content. The ScrollSlier is sized to show the proportion of the scrollable content to the size of the View.Viewport.

▲
█
░
░
░
░
░
░
░
░
░
░
░
░
░
░
░
░
░
▼

ScrollSlider

The ScrollSlider can be dragged with the mouse, constrained by the size of the Viewport of it's superview. The ScrollSlider can be oriented either vertically or horizontally.

██████████████████████████████████████████████████
██████████████████████████████████████████████████
██████████████████████████████████████████████████
██████████████████████████████████████████████████
██████████████████████████████████████████████████

Shortcut

Displays a command, help text, and a key binding. When the key specified by Shortcut.Key is pressed, the command will be invoked. Useful for displaying a command in Bar such as a menu, toolbar, or status bar.

Shortcut  Shortcut help  F1

Slider

Slider control.

●
Demo Text

Slider<T>

Provides a slider control letting the user navigate from a set of typed options in a linear manner using the keyboard or mouse.

SpinnerView

A View which displays (by default) a spinning line character.

●∙∙

StatusBar

A status bar is a View that snaps to the bottom of a Toplevel displaying set of Shortcuts. The StatusBar should be context sensitive. This means, if the main menu and an open text editor are visible, the items probably shown will be F1 Help F2 Save F3 Load. While a dialog to ask a file to load is executed, the remaining commands will probably be F1 Help. So for each context must be a new instance of a status bar.

Ctrl+Z  Quit  Quit │ F1  Help Text  Help │ F10  ☐

Tab

A single tab in a TabView.

╭┤Demo Title├────────────────────────────────────╮
│Demo Text                                       │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
╰────────────────────────────────────────────────╯

TableView

View for tabular data based on a ITableSource. See TableView Deep Dive for more information.

┌──────────────────┬──────────────────────┬──────┐
│StrCol            │DateCol               │IntCol│
├──────────────────┼──────────────────────┼──────►
│Demo text in row 0│12/25/2000 12:00:00 AM│0     │
│Demo text in row 1│12/25/2001 12:00:00 AM│0     │
│Demo text in row 2│12/25/2002 12:00:00 AM│0     │
│Demo text in row 3│12/25/2003 12:00:00 AM│2     │
│Demo text in row 4│12/25/2004 12:00:00 AM│1     │

TabView

Control that hosts multiple sub views, presenting a single one at once.

│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
└────────────────────────────────────────────────┘

TextField

Single-line text entry View

This is a test.

TextValidateField

Text field that validates input through a ITextValidateProvider

Error: ITextValidateProvider not set!

TextView

Multi-line text editing View.

TextView provides a fully featured multi-line text
It supports word wrap and history for undo.

TileView

A View consisting of a moveable bar that divides the display area into resizeable TileView.Tiles.

│
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │
                         │

TimeField

Time editing View

02:48:05

Toplevel

Toplevel views are used for both an application's main view (filling the entire screen and for modal (pop-up) views such as Dialog, MessageBox, and Wizard).

Demo Text

TreeView

Convenience implementation of generic TreeView%601 for any tree were all nodes implement ITreeNode. See TreeView Deep Dive for more information.

├-Root1
│ ├─Child1.1
│ └─Child1.2
└-Root2
  ├─Child2.1
  └─Child2.2

TreeView<T>

Hierarchical tree view with expandable branches. Branch objects are dynamically determined when expanded using a user defined ITreeBuilder%601. See TreeView Deep Dive for more information.

Window

An overlapped container for other views with a border and optional title.

┌┤Demo Title├────────────────────────────────────┐
│Demo Text                                       │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
│                                                │
└────────────────────────────────────────────────┘

Wizard

Provides navigation and a user interface (UI) to collect related data across multiple steps. Each step ( WizardStep) can host arbitrary Views, much like a Dialog. Each step also has a pane for help text. Along the bottom of the Wizard view are customizable buttons enabling the user to navigate forward and backward through the Wizard.

╔╡Demo Title╞════════════════════════════╗
║Demo Text                               ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║                                        ║
║────────────────────────────────────────║
║⟦ Back ⟧                    ⟦► Finish ◄⟧║
╚════════════════════════════════════════╝

WizardStep

Represents a basic step that is displayed in a Wizard. The WizardStep view is divided horizontally in two. On the left is the content view where Views can be added, On the right is the help for the step. Set WizardStep.HelpText to set the help text. If the help text is empty the help pane will not be shown. If there are no Views added to the WizardStep the WizardStep.HelpText (if not empty) will fill the wizard step.

@tig tig requested review from BDisp and Copilot May 31, 2025 18:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request addresses #4107 by updating the Terminal.Gui namespace and API usage across several examples and scenarios to align with the new structure. The key changes include:

  • Removing the old "using Terminal.Gui" directives and replacing them with the appropriate new namespaces.
  • Updating enum references, such as switching from Terminal.Gui.ViewportSettings.Transparent to Terminal.Gui.ViewBase.ViewportSettingsFlags.Transparent (and similar adjustments).
  • Revising multiple example files to ensure consistency with the revamped API.

Reviewed Changes

Copilot reviewed 720 out of 721 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Examples/UICatalog/Scenarios/Bars.cs Removed obsolete using directive
Examples/UICatalog/Scenarios/Arrangement.cs Updated enum references to use new ViewBase.ViewportSettingsFlags syntax
Examples/UICatalog/Scenarios/AnsiRequestsScenario.cs Removed obsolete using directive
Examples/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs Removed obsolete using directive
Examples/UICatalog/Scenarios/AllViewsTester.cs Removed obsolete using directive
Examples/UICatalog/Scenarios/Adornments.cs Removed obsolete using directive
Examples/UICatalog/Scenario.cs Removed obsolete using directive
Examples/UICatalog/README.md Removed obsolete using directive from sample code
Examples/SelfContained/Program.cs Replaced Terminal.Gui using with multiple new namespace references
Examples/ReactiveExample/ViewExtensions.cs Replaced Terminal.Gui using with new ViewBase and Views namespaces
Examples/ReactiveExample/TerminalScheduler.cs Updated using directive to reference Terminal.Gui.App
Examples/ReactiveExample/Program.cs Updated using directives to include Terminal.Gui configuration and App namespaces
Examples/ReactiveExample/LoginViewModel.cs Updated using directive to use Terminal.Gui.Input
Examples/ReactiveExample/LoginView.cs Updated using directives to use Terminal.Gui.App and related namespaces
Examples/NativeAot/Program.cs Updated using directives to use multiple new Terminal.Gui namespaces
Examples/Example/Example.cs Updated using directives and commentary to reflect new API usage
Examples/CommunityToolkitExample/Program.cs Updated using directives to include Terminal.Gui configuration and App namespaces
Examples/CommunityToolkitExample/LoginViewModel.cs Updated using directives to use new Terminal.Gui configuration and Drawing namespaces
Examples/CommunityToolkitExample/LoginView.cs Updated using directives to use Terminal.Gui.App and ViewBase namespaces
Files not reviewed (1)
  • Examples/CommunityToolkitExample/LoginView.Designer.cs: Language not supported

@tig

tig commented May 31, 2025

Copy link
Copy Markdown
Member Author

I'm going to do one more check and then merge this... Probably within the next few hours.

@tznind ?

Comment thread Examples/UICatalog/Scenarios/ConfigurationEditor.cs
@tig tig merged commit cab2256 into tui-cs:v2_develop May 31, 2025
11 checks passed
@tig

tig commented May 31, 2025

Copy link
Copy Markdown
Member Author

@BDisp - The Gitub push to nuget action is failing because the release build is failing.

This has something to do with the AOT and self-contained examples.

I think there's some magic required to make this work that you helped invent. Can you please help me?

https://github.com/gui-cs/Terminal.Gui/actions/runs/15367926812

@BDisp

BDisp commented Jun 1, 2025

Copy link
Copy Markdown
Collaborator

Comment out the following lines in the DeepCloner.cs file and it works fine. I think the SourceGenerationContext is already used no matter it's AOT or not.

            //throw new InvalidOperationException (
            //                                     $"Type {typeof (T).FullName} is not properly registered in SourceGenerationContext " +
            //                                     $"for AOT-compatible cloning.");

@tig

tig commented Jun 1, 2025

Copy link
Copy Markdown
Member Author

That's a fix for AOT, maybe. But it still fails in the Action.

It has something to do with the fact both these examples rely on nuget fore Release:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <Nullable>enable</Nullable>
    <PublishTrimmed>true</PublishTrimmed>
    <TrimMode>Link</TrimMode>
    <PublishSingleFile>true</PublishSingleFile>
    <InvariantGlobalization>false</InvariantGlobalization>
    <DebugType>embedded</DebugType>
  </PropertyGroup>

  <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />
    <TrimmerRootAssembly Include="Terminal.Gui" />
  </ItemGroup>

  <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <PackageReference Include="Terminal.Gui" />
    <TrimmerRootAssembly Include="Terminal.Gui" />
  </ItemGroup>

</Project>

@BDisp

BDisp commented Jun 1, 2025

Copy link
Copy Markdown
Collaborator

It was using the local_packages folder before in release mode. I'll see it better tomorrow.

@tig

tig commented Jun 1, 2025

Copy link
Copy Markdown
Member Author

I figured it out. Turns out, to enable global usings for all the new namespaces, I created an /Terminal.Gui/AssemblyInfo.cs thinking that would be a good place to put them.

Now they are in Application.cs:

// We use global using directives to simplify the code and avoid repetitive namespace declarations.
// Put them here so they are available throughout the application.
// Do not put them in AssemblyInfo.cs as it will break GitVersion's /updateassemblyinfo
global using Attribute = Terminal.Gui.Drawing.Attribute;
global using Color = Terminal.Gui.Drawing.Color;
global using CM = Terminal.Gui.Configuration.ConfigurationManager;
global using Terminal.Gui.App;
global using Terminal.Gui.Drivers;
global using Terminal.Gui.Input;
global using Terminal.Gui.Configuration;
global using Terminal.Gui.ViewBase;
global using Terminal.Gui.Views;
global using Terminal.Gui.Drawing;
global using Terminal.Gui.Text;
global using Terminal.Gui.Resources;
global using Terminal.Gui.FileServices;

And it fixes everything.

image

@BDisp

BDisp commented Jun 1, 2025

Copy link
Copy Markdown
Collaborator

Good catch. Don't forget to add using System.Diagnostics; into the Application.cs.

@BDisp

BDisp commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator

I figured it out. Turns out, to enable global usings for all the new namespaces, I created an /Terminal.Gui/AssemblyInfo.cs thinking that would be a good place to put them.

Now they are in Application.cs:

// We use global using directives to simplify the code and avoid repetitive namespace declarations.
// Put them here so they are available throughout the application.
// Do not put them in AssemblyInfo.cs as it will break GitVersion's /updateassemblyinfo
global using Attribute = Terminal.Gui.Drawing.Attribute;
global using Color = Terminal.Gui.Drawing.Color;
global using CM = Terminal.Gui.Configuration.ConfigurationManager;
global using Terminal.Gui.App;
global using Terminal.Gui.Drivers;
global using Terminal.Gui.Input;
global using Terminal.Gui.Configuration;
global using Terminal.Gui.ViewBase;
global using Terminal.Gui.Views;
global using Terminal.Gui.Drawing;
global using Terminal.Gui.Text;
global using Terminal.Gui.Resources;
global using Terminal.Gui.FileServices;

And it fixes everything.

image

Seems that's also possible to add global Using's in a .csproj file into a <ItemGroup>:

  <ItemGroup>
    <Using Include="Terminal.Gui.Drawing.Attribute">
      <Alias>Attribute</Alias>
    </Using>
    <Using Include="Terminal.Gui.Drawing.Color">
      <Alias>Color</Alias>
    </Using>
    <Using Include="Terminal.Gui.Configuration.ConfigurationManager">
      <Alias>CM</Alias>
    </Using>
    <Using Include="Terminal.Gui.App" />
    <Using Include="Terminal.Gui.Drivers" />
    <Using Include="Terminal.Gui.Input" />
    <Using Include="Terminal.Gui.Configuration" />
    <Using Include="Terminal.Gui.ViewBase" />
    <Using Include="Terminal.Gui.Views" />
    <Using Include="Terminal.Gui.Drawing" />
    <Using Include="Terminal.Gui.Text" />
    <Using Include="Terminal.Gui.Resources" />
    <Using Include="Terminal.Gui.FileServices" />
  </ItemGroup>

These one I have no idea how to include in a .csproj:

global using Attribute = Terminal.Gui.Drawing.Attribute;
global using Color = Terminal.Gui.Drawing.Color;
global using CM = Terminal.Gui.Configuration.ConfigurationManager;

I also don't know if including namespaces in a .csproj will break GitVersion's /updateassemblyinfo.

Edit:
I already figure out. See above the changes made for alias. But I don't know if will break GitVersion's /updateassemblyinfo.

@BDisp

BDisp commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator

I see know that's possible by setting project properties:

image

@Pascal-So Pascal-So mentioned this pull request Jan 12, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit Terminal.Gui namespaces

8 participants