Skip to content

Conversation

BDisp
Copy link
Collaborator

@BDisp BDisp commented Sep 16, 2025

Fixes

Proposed Changes/Todos

  • Uses Unix native libraries

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@BDisp BDisp requested a review from tig as a code owner September 16, 2025 00:12
@BDisp BDisp requested a review from tznind September 16, 2025 00:14
@tznind
Copy link
Collaborator

tznind commented Sep 16, 2025

What is the benefits of these lib methods vs pure ansi?

Is it faster? More compatible?

@BDisp
Copy link
Collaborator Author

BDisp commented Sep 16, 2025

What is the benefits of these lib methods vs pure ansi?

I didn't understood quite well your question. I used pure ansi in all places where the other drivers use it. The lib methods used here are for leverage native unix libs in the implementation.

For e.g. to set console raw mode which allow intercept all the input keys, even Ctrl+C:

  • v2win use console modes.
  • v2net use Console.TreatControlCAsInput = true;.
  • v2unix use the EnableRawModeAndTreatControlCAsInput method.

So, no pure ansi are used above. But you may referring something that I don't know yet.

Is it faster? More compatible?

Honestly I don't know. Needed to test with benchmark to compare it. But it seems very faster. I also think it's more compatible than System.Console which not all of their objects are Unix compatible.

@BDisp BDisp mentioned this pull request Sep 16, 2025
Copy link
Collaborator

@tig tig left a comment

Choose a reason for hiding this comment

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

See my comments.

@tig tig requested a review from Copilot September 22, 2025 06:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new Unix driver (v2unix) that uses native Unix libraries for Terminal.Gui, addressing issue #4250. The implementation provides native Unix input/output capabilities as an alternative to the existing .NET-based drivers.

Key changes include:

  • Implementation of Unix-specific input/output classes using native Unix system calls
  • Integration of the new driver into the existing v2 driver architecture
  • Enhanced keyboard input handling with support for Alt key combinations and control sequences

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Terminal.Gui/Drivers/V2/UnixInput.cs Core Unix input implementation using native libc calls for terminal I/O
Terminal.Gui/Drivers/V2/UnixOutput.cs Unix output implementation with native terminal control and cursor positioning
Terminal.Gui/Drivers/V2/UnixInputProcessor.cs Input processor for handling Unix character stream processing
Terminal.Gui/Drivers/V2/UnixKeyConverter.cs Key converter for mapping Unix chars to Terminal.Gui Key objects
Terminal.Gui/Drivers/V2/UnixComponentFactory.cs Factory class for creating Unix driver components
Terminal.Gui/Drivers/V2/ApplicationV2.cs Integration of Unix driver into the application framework
Terminal.Gui/Drivers/EscSeqUtils/EscSeqUtils.cs Enhanced escape sequence utilities with new MapChar method
Terminal.Gui/Drivers/AnsiResponseParser/Keyboard/EscAsAltPattern.cs Extended pattern matching for Alt key combinations with control characters
Tests/UnitTests/Input/EscSeqUtilsTests.cs New test coverage for MapChar functionality
Tests/UnitTests/ConsoleDrivers/AnsiKeyboardParserTests.cs Enhanced keyboard parser tests with Alt modifier support
Comments suppressed due to low confidence (1)

Terminal.Gui/Drivers/V2/UnixInput.cs:1

  • This should be duplicating STDIN_FILENO (0) not STDOUT_FILENO (1) since this is in the UnixInput class and the method is creating a stdin writer, not stdout.
using System.Runtime.InteropServices;

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tig tig merged commit 9d34e27 into gui-cs:v2_develop Oct 2, 2025
11 checks passed
@BDisp BDisp deleted the v2_4250_v2unix-new branch October 2, 2025 14:53
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.

Add a v2unix driver
3 participants