Refactor ConsoleDrivers to remove duplicate code
There is a LOT of common code across the three (now four with Fake) Drivers.
I was just thinking about how to fix bugs related to non-printable chars causing rendering issues on some terminals. For example, in Windows Terminal and Fluent if AddRune gets called with \n it does this:

The fix is to modify AddRune to look for non-printable chars like this, that may cause the underlying console to take action and replace them with the right glyph. E.g:

However, it's stupid to do this 4 times. Instead the base should implement the least-common-denominator functionality.
Right?
Right. @migueldeicaza want to do all this stuff in the View, so drivers doesn't have to be magic. The View must send the right format to the AddStr and AddRune.
What if we did this:
- Gave View a
Textproperty. DefaultRedrawwould drawTextusingTextAlignment - Refactored
Labelsuch that it was nothing more than a renaming ofView - Refactored
Button, etc... to leverage all the text handling in View. -
Windowwould need to leverage this too.
???
I agree. We also have to redirect the Driver property to the View itself in order to deviate all the call to the Driver.AddRune and Driver.AddStr to the View and avoiding the views derived from View do call Application.Driver.
I think that this have to change to another way:
public static ConsoleDriver Driver { get { return Application.Driver; } }
to like:
public static ConsoleDriver Driver { get { return View.Driver; } }
But I'm still studing. More thoughts???
I think this makes sense.
The abstract capability is more of an indicator that some holes need to be plugged by concrete implementations, but we could move common code here.
I think is already fixed with your creating of the public static Rune MakePrintable (Rune c) method and the TextFormatter class.
So, besides the ConsoleDriver can and must have common code, it must be abstract.
Woo-hoo! Finally!
It ain't perfect, but this radically simplifies and improves the ability to prove quality.