migueldeicaza / TermKit

Terminal Kit - Console UI toolkit for Swift applications
MIT License
461 stars 17 forks source link

Porting code from gui.cs Tracking Issue #16

Open migueldeicaza opened 3 years ago

migueldeicaza commented 3 years ago

This issue tracks my notes on the porting bits that I have done while moving code from gui.cs written in C# and TermKit written in Swift.

Generally, TermKit uses the same model of gui.cs, but has been adapted to the Swift language, and among other things, takes advantage of "Char" being a proper Unicode character.

While I have been porting most of the code from gui.cs to TermKit, in a few instances in the core, I have either not embraced a particular change, either because I do not like what is there on the C# code base, or because I am planning on using something different in TermKit. Some of those are documented here, and I will update as I audit or remember more things

Design Differences

While gui.cs embraced a more powerful View by default, one that contains text and rendering options, I chose to not put this into TermKit for now.

To deal with boundaries and the cursor location, in TermKit, I am using a drawing context that keeps track of this during the drawing stage, so it does not take space on the View itself to track.

Future Directions

Currently, TermKit is using ncurses for its Unix backend, but I am going to provide a direct version that speaks directly to the terminal, because (a) it is not that hard to write, (b) we would have a lot better control what what ncurses offer, but (c) would help me avoid dealing with the various versions and configurations of ncurses that ship in the wild that are nothing but a source of pain (specially dealing with colors, timeouts and unicode).

Audit Results

I have recently completed an Audit (as of Jan 2021) and the following pieces of code are either fully ported, or I consider them done for the purposes of the port. The checked options mean completed, others are open tasks:

Views are now tracked as individual bugs

Clipping:

Rendering:

Some of these controls either exist, but have not been synced to the fixes and features of gui.cs, or I have not ported them yet:

Most of the Dialogs: