We welcome contributions from the community. See Issues for a list of open bugs and enhancements. Contributors looking for something fun to work on should look at issues tagged as:
Terminal.Gui uses the GitFlow branching model.
v1_release_
and v2_release
branches are always stable, and always matches the most recently released Nuget package.v1__develop
and v2_develop
branches are where new development and bug-fixes happen. v2_develop
is the default Github branch.Use GitHub to fork the Terminal.Gui
repo to your account (https://github.com/gui-cs/Terminal.Gui/fork).
Clone your fork to your local machine
git clone https://github.com/<yourID>/Terminal.Gui
Now, your local repo will have an origin
remote pointing to https://github.com/<yourID>/Terminal.Gui
.
Add a remote for upstream
:
git remote add upstream https://github.com/gui-cs/Terminal.Gui
You now have your own fork and a local repo that references it as origin
. Your local repo also now references the orignal Terminal.Gui repo as upstream
.
Ensure your local v1_develop
(for v1) or v2_develop
(for v2) branch is up-to-date with upstream
(github.com/gui-cs/Terminal.Gui
):
cd ./Terminal.Gui
git checkout v2_develop
git pull upstream v2_develop
Create a new local branch:
git checkout -b my_new_branch
Follow all the guidelines below.
When you're ready, commit your changes:
git add .
git commit -m "Fixes #1234. Some bug"
Push your local branch to your fork (origin
):
git push --set-upstream origin my_new_branch
Create the Pull Request:
In the output of the git push
command you'll see instructions with a link to the Pull Request:
$ git push --set-upstream origin my_new_branch
Enumerating objects: 8, done.
...
remote:
remote: Create a pull request for 'my_new_branch' on GitHub by visiting:
remote: https://github.com/<yourID>/Terminal.Gui/pull/new/more_doc_fixes
remote:
...
(in Windows Terminal, just CTRL-Click on the URL)
Follow the template instructions found on Github.
Terminal.Gui uses a derivative of the Microsoft C# Coding Conventions, with any deviations from those (somewhat older) conventions codified in the .editorconfig for the solution, as well as even more specific definitions in team-shared dotsettings files, used by ReSharper and Rider.\ Before you commit code, please run the formatting rules on only the code file(s) you have modified, in one of the following ways, in order of most preferred to least preferred:
Ctrl-E-C
if using ReSharper or Ridercleanupcode.exe relative/path/to/your/file.cs
Ctrl-K-D
in Visual Studio (with default C# developer key bindings), to apply the subset of the formatting rules that Visual Studio can apply.Terminal.Gui, as a UI framework, heavily influences how console graphical user interfaces (GUIs) work. We use the following tenets to guide us:
NOTE: Like all tenets, these are up for debate. If you disagree, have questions, or suggestions about these tenets and guidelines submit an Issue using the design tag.
ctrl/command-c
, ctrl/command-v
, and ctrl/command-x
keyboard shortcuts for cut, copy, and paste versus defining new shortcuts.ctrl/command-q
quits/exits all modal views. See Issue #456 as a counter-example that should be fixed.alt
key in a Terminal.Gui app will activate the MenuBar
, but in Unix, the user has to press the full hotkey (e.g. alt-f
) or F9
.Terminal.Gui provides an API that is used by many. As the project evolves, contributors should follow these tenets to ensure Consistency and backward compatibility.
NOTE: Like all tenets, these are up for debate. If you disagree, have questions, or suggestions about these tenets and guidelines submit an Issue using the design tag.
Great care has been provided thus far in ensuring Terminal.Gui has great API Documentation. Contributors have the responsibility of continuously improving the API Documentation.
<summary></summary>
terse.<see cref=""/>
liberally to cross-link topics.<remarks></remarks>
to add more context and explanation.docfx/articles
folder as a .md
file. It will automatically get picked up and be added to Conceptual Documentation.The Microsoft .NET Framework Design Guidelines provides these guidelines for defining events:
Events always refer to some action, either one that is happening or one that has occurred. Therefore, as with methods, events are named with verbs, and verb tense is used to indicate the time when the event is raised.
✔️ DO name events with a verb or a verb phrase.
Examples include Clicked, Painting, DroppedDown, and so on.
✔️ DO give events names with a concept of before and after, using the present and past tenses.
For example, a close event that is raised before a window is closed would be called Closing, and one that is raised after the window is closed would be called Closed.
❌ DO NOT use "Before" or "After" prefixes or postfixes to indicate pre- and post-events. Use present and past tenses as just described.
✔️ DO name event handlers (delegates used as types of events) with the "EventHandler" suffix, as shown in the following example:
✔️ DO name event argument classes with the "EventArgs" suffix.
event EventHandler<T>
idiom.virtual
event raising function, named as OnEventToRaise
. Typical implementations will simply do a EventToRaise?.Invoke(this, eventArgs)
.event
as in public event EventHandler<EventArgs> EventToRaise
theobject.EventToRaise += (sender, args) => {};
EventToRaise
can override OnEventToRaise
as needed.EventArgs
should be provided and the old and new state should be included. By doing this, event handler methods do not have to query the sender for state.See also: https://www.codeproject.com../docs/20550/C-Event-Implementation-Fundamentals-Best-Practices
View
classesAbsolute Layout
).var foo = new Foo() { a = b };
).UICatalog
demo for the new class illustrates both Absolutle Layout
and Computed Layout
.<remark></remark>
to the XML Documentation to the code describing the breaking change. These will get picked up in the API Documentation.PRs should never cause code coverage to go down. Ideally, every PR will get the project closer to 100%. PRs that include new functionality (e.g. a new control) should have at least 70% code coverage for the new functionality.
Terminal.Gui has an automated unit or regression test suite. See the Testing wiki.
We analyze unit tests and code coverage on each PR push.
The code coverage of the latest released build (on NuGet) is shown as a badge at the top of README.md
. Here as well:
The project uses Fine Code Coverage to allow easy access to code coverage info on a per-component basis.
Use the following command to generate the same CC info that the Publish Github Action uses to publish the results to the badge:
dotnet test --no-restore --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
Then open up the resulting coverage.opencover.xml
file and you'll see the sequenceCoverage
value:
<?xml version="1.0" encoding="utf-8"?>
<CoverageSession>
<Summary numSequencePoints="15817" visitedSequencePoints="7249" numBranchPoints="9379" visitedBranchPoints="3640" sequenceCoverage="45.83" branchCoverage="38.81" maxCyclomaticComplexity="10276" minCyclomaticComplexity="10276" visitedClasses="105" numClasses="141" visitedMethods="965" numMethods="1751" />
UI Catalog is a great sample app for manual testing.
When adding new functionality, fixing bugs, or changing things, please either add a new Scenario
to UICatalog or update an existing Scenario
to fully illustrate your work and provide a test-case.