Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tig committed Jan 22, 2024
2 parents 5461e37 + d0d7650 commit 6930043
Show file tree
Hide file tree
Showing 240 changed files with 6,894 additions and 996 deletions.
69 changes: 30 additions & 39 deletions .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,44 @@ name: Build and publish API docs

on:
push:
branches: [main]
# only publish v2 (main or develop); v2 is published via the Terminal.GuiV2Docs repo
branches: [main, develop]

permissions:
id-token: write
pages: write

jobs:
generate-docs:
# Single deploy job since we're just deploying
deploy:
name: Build and Deploy API docs to github-pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 6.0.100

- name: Setup DocFX
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install docfx

- name: Install dependencies
run: dotnet restore

- name: DocFX Build
working-directory: docfx
# https://stackoverflow.com/questions/56726429/how-to-run-multiple-commands-in-one-github-actions-docker
run: |
rm ../docs -Recurse -Force -ErrorAction SilentlyContinue
docfx docfx.json
continue-on-error: false

- name: Publish
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
dotnet tool install -g docfx
$env:DOCFX_SOURCE_BRANCH_NAME="${{ github.ref_name }}"
docfx metadata
docfx build
continue-on-error: false

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs
force_orphan: true

# - name: Use docfx to build API Docs
# uses: nikeee/[email protected]
# with:
# args: docfx/docfx.json

# # Publish generated site using GitHub Pages
# - uses: maxheld83/ghpages@master
# name: Publish API Documentation on GitHub Pages
# env:
# BUILD_DIR: docs # docfx's default output directory is _site
# GH_PAT: ${{ secrets.GH_PAT }} # See https://github.com/maxheld83/ghpages
path: docfx/_site

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
# Override language selection by uncommenting this and choosing your languages
with:
languages: csharp

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -65,4 +65,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
81 changes: 81 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "develop", "main", "v2", "v2_develop" ]
pull_request:
branches: [ "develop", "main", "v2", "v2_develop" ]
schedule:
- cron: '35 4 * * 2'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'javascript-typescript' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0
dotnet-quality: 'ga'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
id: gitversion # step id used as reference for output values

- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0
dotnet-quality: 'ga'
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ packages

# API Docs
docfx/api

# Never push ./docs folder - the gh-pages branch is now used to publish to GH Pages
docs/
docfx/_site

UnitTests/TestResults

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
***The current, stable, release of Terminal.Gui is [v1.x](https://www.nuget.org/packages/Terminal.Gui). It is stable, rich, and broadly used. The team is now focused on designing and building a significant upgrade we're referring to as `v2`. Therefore:***
* *`v1` is now in maintenance mode, meaning we will accept PRs for v1.x (the `develop` branch) only for issues impacting existing functionality.*
* *All new development happens on the `v2_develop` branch. See the V2 discussion [here](https://github.com/gui-cs/Terminal.Gui/discussions/1940).*
* *The latest v2 API Docs* (generated from `v2_develop`) can be found [here](https://gui-cs.github.io/Terminal.GuiV2Docs/).
* *Developers are encouraged to continue building on [v1.x](https://www.nuget.org/packages/Terminal.Gui) until we announce `v2` is stable.*

**Terminal.Gui**: A toolkit for building rich console apps for .NET, .NET Core, and Mono that works on Windows, the Mac, and Linux/Unix.
Expand All @@ -35,7 +36,7 @@ dotnet run
* [Terminal.Gui Overview](https://gui-cs.github.io/Terminal.Gui/articles/overview.html)
* [List of Views/Controls](https://gui-cs.github.io/Terminal.Gui/articles/views.html)
* [Conceptual Documentation](https://gui-cs.github.io/Terminal.Gui/articles/index.html)
* [API Documentation](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui/Terminal.Gui.html)
* [API Documentation](https://gui-cs.github.io/Terminal.Gui)

_The Documentation matches the most recent Nuget release from the `main` branch ([![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui))_

Expand Down
6 changes: 3 additions & 3 deletions ReactiveExample/ReactiveExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<InformationalVersion>1.14.0-pre.1+Branch.develop.Sha.e0b7464669ef87b96b57f2285200e02bcf85d0e7</InformationalVersion>-->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI.Fody" Version="19.4.1" />
<PackageReference Include="ReactiveUI" Version="19.4.1" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.2.3" PrivateAssets="all" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.39" />
<PackageReference Include="ReactiveUI" Version="19.5.39" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
Expand Down
80 changes: 72 additions & 8 deletions Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ void ProcessInput ()
Key k = Key.Null;

if (code == Curses.KEY_CODE_YES) {
var lastWch = wch;
while (code == Curses.KEY_CODE_YES && wch == Curses.KeyResize) {
ProcessWinChange ();
code = Curses.get_wch (out wch);
Expand Down Expand Up @@ -379,6 +380,25 @@ void ProcessInput ()
} else if (wch >= 325 && wch <= 327) { // Shift+Alt+(F1 - F3)
wch -= 60;
k = Key.ShiftMask | Key.AltMask | MapCursesKey (wch);
} else {
code = Curses.get_wch (out wch);
if (code == 0) {
switch (wch) {
// Shift code.
case 16:
keyModifiers.Shift = true;
break;
default:
if (lastWch == Curses.KeyResize && wch == 91) {
// Returns this keys to the std input which is a CSI (\x1b[).
Curses.ungetch (91); // [
Curses.ungetch (27); // Esc
return;
} else {
throw new Exception ();
}
}
}
}
keyDownHandler (new KeyEvent (k, MapKeyModifiers (k)));
keyHandler (new KeyEvent (k, MapKeyModifiers (k)));
Expand All @@ -388,8 +408,6 @@ void ProcessInput ()

// Special handling for ESC, we want to try to catch ESC+letter to simulate alt-letter as well as Alt-Fkey
if (wch == 27) {
Curses.timeout (10);

code = Curses.get_wch (out int wch2);

if (code == Curses.KEY_CODE_YES) {
Expand Down Expand Up @@ -425,6 +443,56 @@ void ProcessInput ()
} else if (wch >= (uint)Key.A && wch <= (uint)Key.Z) {
keyModifiers.Shift = true;
keyModifiers.Alt = true;
} else if (wch2 == Curses.KeySS3) {
while (code > -1) {
code = Curses.get_wch (out wch2);
if (code == 0) {
switch (wch2) {
case 16:
keyModifiers.Shift = true;
break;
case 108:
k = (Key)'+';
break;
case 109:
k = (Key)'-';
break;
case 112:
k = Key.InsertChar;
break;
case 113:
k = Key.End;
break;
case 114:
k = Key.CursorDown;
break;
case 115:
k = Key.PageDown;
break;
case 116:
k = Key.CursorLeft;
break;
case 117:
k = Key.Clear;
break;
case 118:
k = Key.CursorRight;
break;
case 119:
k = Key.Home;
break;
case 120:
k = Key.CursorUp;
break;
case 121:
k = Key.PageUp;
break;
default:
k = (Key)wch2;
break;
}
}
}
} else if (wch2 < 256) {
k = (Key)wch2;
keyModifiers.Alt = true;
Expand Down Expand Up @@ -559,7 +627,6 @@ void ProcessContinuousButtonPressed (MouseFlags mouseFlag, Point pos)
public override void PrepareToRun (MainLoop mainLoop, Action<KeyEvent> keyHandler, Action<KeyEvent> keyDownHandler, Action<KeyEvent> keyUpHandler, Action<MouseEvent> mouseHandler)
{
// Note: Curses doesn't support keydown/up events and thus any passed keyDown/UpHandlers will never be called
Curses.timeout (0);
this.keyHandler = keyHandler;
this.keyDownHandler = keyDownHandler;
this.keyUpHandler = keyUpHandler;
Expand All @@ -572,9 +639,7 @@ public override void PrepareToRun (MainLoop mainLoop, Action<KeyEvent> keyHandle
return true;
});

mLoop.WinChanged += () => {
ProcessInput ();
};
mLoop.WinChanged += () => ProcessWinChange ();
}

public override void Init (Action terminalResized)
Expand All @@ -585,6 +650,7 @@ public override void Init (Action terminalResized)
try {
window = Curses.initscr ();
Curses.set_escdelay (10);
Curses.nodelay (window.Handle, true);
} catch (Exception e) {
throw new Exception ($"Curses failed to initialize, the exception is: {e.Message}");
}
Expand Down Expand Up @@ -673,13 +739,11 @@ public override void Init (Action terminalResized)

ResizeScreen ();
UpdateOffScreen ();

}

public override void ResizeScreen ()
{
Clip = new Rect (0, 0, Cols, Rows);
Curses.refresh ();
}

public override void UpdateOffScreen ()
Expand Down
Loading

0 comments on commit 6930043

Please sign in to comment.