Git Product home page Git Product logo

Comments (28)

migueldeicaza avatar migueldeicaza commented on May 16, 2024 1

As for Sixel support:

I implemented Sixel support (and a bunch of other graphic APIs) in my Swift version of the terminal emulator, and it could be easily backported to XtermSharp.

XtermSharp could get a big boost by bringing all the changes I did to SwiftTerm, I kept an issue to track those here:

migueldeicaza/XtermSharp#79

from terminal.gui.

migueldeicaza avatar migueldeicaza commented on May 16, 2024

Someone at Build told me about a full VT emulator they were about to open source, it is here:

darrenstarr/VtNetCore#4

Need to wait for the license to be official, then we can use it.

from terminal.gui.

migueldeicaza avatar migueldeicaza commented on May 16, 2024

Working on one as part of XtermSharp: https://github.com/migueldeicaza/XtermSharp the GuiCsConsole has it, will split it out later.

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

Hi, it seems @darrenstarr has updated the License to MIT.
I'm currently looking to add Escape-Sequence Support to the .NET Core Console and wonder whether to choose XtermSharp or VtNetCore. Can you provide advice?

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

It depends what you’re looking for. I was going for compatibility. So if you look at the UWP example, you’ll find it’s pretty complete.

Since I went for maximum compatibility and support all scrolling modes as well as protected areas and characters, it might not be as fast as some other libraries.

Once I start my new job at the university, I’ll have time to support it better and if it’s possible to do so, I’ll move to a no-copy model as well as switching to a hierarchal state machine for parsing. This might be an issue since I found a lot of cases (beyond standard VT320) which breaks state machine and cause artifacts.

I’m also planning on supporting sixel graphics which may seem silly, but is great for things like math.

The greatest weakness in the implementation currently is that I’m not invalidating with time enough control. This is because UWP tends to handle redraws coarsely.

I’ll finish ISO2022 (if I remember the number) encoding support as well as X-JIS as soon as I get a chance.

Let me know if there’s anything I can do to help. No exaggeration, I wrote most of VtNetCore in a weekend. The rest has been adding more and more features.

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

@darrenstarr thank you, currently I only want basic foreground/background colors. Actually I was about to write a simple parser myself and translate the Codes into the corresponding System.Console Commands, but it would be better to re-use a parser done properly ;-)

I don't see any Adapter to Console Functionality in your Code though. Do you think I am on the right track using your code for what I want to achieve? Could you give me a Code-hint to start with?
Best regards...

PS: to clarify, I know I can enable all this on the Windows10 Console and many Unix Terminals, but I would like to stick with the standard .NET Core Console.

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

The XtermParser component of my code isn’t too hard to use for that. It parses everything, but if you implement a controller (inherit it) and implement the functions you want, it should do what you’re looking for.

I am on my phone now, but I can talk more intelligently about it when I’m in front of a keyboard. :)

I warn against making an oversimplified parser... it’s absolutely amazing how many crazy cases there are. But if you have a controlled data set... it might not be an issue.

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

Sorry... responded before reading the whole thing.
I didn’t do a System.Console view. But it wouldn’t take long to do it I think. If I can get 20 minutes tomorrow, I’ll see what I can get up and running. It is abstracted.

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

@darrenstarr That's why I'm asking, no worries, I won't, although it seems tempting.
You don't really have to program it though. I would rather 'use' than 'subclass'. I see that VirtualTerminalController is not abstract, but it has many events. I suppose one could subscribe to these and to the proper handling?

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

Look at IVirtualTerminalController. Subclass it, then implement the interesting features. Pass your instance to the DataConsumer class. The DataConsumer is the parser and the IVirtualTerminalController is what it calls as it parses. You just need to push data to the consumer.

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

Ah, I see, a very broad Interface, but quite specific and I can leave Methods empty if they don't interest me. Just out of curiosity, what does the concrete VirtualTerminalController do? What is its purpose? Is it the "model" for the Terminal GUI?

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

It is the model... but to use the term loosely, it's an observable model. If you look at https://github.com/darrenstarr/VtNetCore.UWP you'll see there's an implementation for UWP and I also had Cocoa working at one point, but I haven't followed up on it. There's also an AvaloniaUI version which is used by AvaloniaStudio.

You can leave empty as much as you want. The definitions for some of the items are pretty specific. INCITS 4-1986[R2012] (or ISO6429 C0 & C1 codes) ... Wikipedia does a great job describing them https://en.wikipedia.org/wiki/C0_and_C1_control_codes

This is pretty important for how you'll handle backspace, and tabs and such. I doubt you'll need to be concerned with it, but shift in and shift out are pretty confusing,

Be mindful of "SetUtf8()", the parser will take care of this itself, but it could be useful to make sure that it's sent at the start of a session. By default, 8-bit values mean ASCII-extended (if I recall correctly).

I should probably provide header documentation in IVirtualTerminalController now that I'm pretty sure it's there to stay :)

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

public void SetCharacterAttribute(int parameter)

This is the function I think you're most interested in. It's the most common method of setting the text color.

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

@darrenstarr thanks again, would you care for a pull request with my implementation of a ConsoleTerminal.cs when I'm ready?

I have to sort it out with a change I did: I switched to System.ConsoleKey and ConsoleModifiers modifiers. Would you object to that?

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

I had no idea there was a .NET Core solution to that... I'm concerned that it will have an issue with IMEs... if I understand correctly, there is no .NET Core mapper for ConsoleKey/ConsoleModifiers and unicode.

I'll look into what's being done on Windows Terminal. I am guessing they have a solution for that :)

In the meantime, I don't see any drawback to having an alternative.

I'm always interested in pull requests. :)

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

I created a Core 1.1 Solution and ConsoleKey/ConsoleModifiers were available. What are IMEs?

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

Input method editors. If you were to watch a person type in Korean for example, they have the same key codes as we have, but each key has a different meaning than ours do. As they type more, the characters combine to create more complex characters.

Of course at this time, I don't have support for complex scripts, but I write in Norwegian, Danish, Swedish and Spanish quite often. When I switch between keyboard layouts the key codes for each button don't change, but they need to be interpretted differently. For example ';' and 'ø' are the same key code using ConsoleKey on my keyboard depending on which IME I'm using.

Handwriting and voice input should also be considered.

Surprisingly, at Opera (back when I was a developer there), I think we used 2000+ hours to get basic support for keyboard input as such. Windows has translation tools built in to deal with that issue though. I'll have to read more on ECMA-48 to better understand how to support internationalization. But for now, the method I'm using works for latin scripts.

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

ping... @SpocWeb is there anything I can help you with? Or did you decide my code was so horrible you abandoned it? :)

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

No, sorry, I was busy. Now I'm fighting conflicting private and business git credentials...
I prepared a pull-Request, please have a look at it.
I wasn't aware of Windows Terminal either.
But it's in C++ anyway.

from terminal.gui.

migueldeicaza avatar migueldeicaza commented on May 16, 2024

Well, I am biased, so I would recommend my terminal and will eventually bundle it here, but it is really up to you.

from terminal.gui.

SpocWeb avatar SpocWeb commented on May 16, 2024

I thought so ;-) would do the same, but Darren's solution seemed much more complete, so I adapted it.
BTW I would like to express my admiration for the hard work you've been doing for ages on Mono, Xamarin and open source projects like your Excel Clone...

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

I’m teaching all week (and next) so I’ll handle the day pull request after :) Thanks!

And Miguel, I am biased too :) But, if you started before me, I would have extended yours instead.

As for Microsoft Terminal... it is beautiful and those guys are really working wonders. It was a real shame they chose to kill portability by making it C++. I plan to port their DirectX view when I can find the time. I am a little concerned that they are basing their state machine on an antiquated VT520 doc. And I’m a little worried that their line wrapping logic could keep them from implementing protected regions without some considerable refactoring.

Either way, my code, Miguel’s and Richard’s team’s are all really good and it’s fantastic that we’re finally getting proper terminal support on Windows in the open source :)

from terminal.gui.

migueldeicaza avatar migueldeicaza commented on May 16, 2024

XtermSharp now contains a gui.cs terminal emulator:

https://github.com/migueldeicaza/XtermSharp/tree/master/GuiCsHost

from terminal.gui.

 avatar commented on May 16, 2024

@darrenstarr

I’m also planning on supporting sixel graphics which may seem silly, but is great for things like math.

Did you implement sixel? If so I would love to give it a spin. :)

from terminal.gui.

darrenstarr avatar darrenstarr commented on May 16, 2024

from terminal.gui.

migueldeicaza avatar migueldeicaza commented on May 16, 2024

I did an implementation using XtermSharp, which could use an update:

https://github.com/migueldeicaza/XtermSharp/tree/master/GuiCsHost

I think the major issue is whether the code above gets merged into gui.cs (and thus takes a dependency on XtermSharp), or if XtermSharp takes a dependency on gui.cs, or if I split this out so neither gui.cs or XtermSharp take dependencies, and the terminal emulator is standalone.

from terminal.gui.

 avatar commented on May 16, 2024

Would there be a way to test sixel at this time?

I have an interest in image-supporting terminals, and if another embeddable terminal widget can now do it I would love to advertise it. :)

from terminal.gui.

migueldeicaza avatar migueldeicaza commented on May 16, 2024

Someone would need to port the code from Swift to C#, I do not currently have much time to devote to that backport.

That said, you could try SwiftTerm which supports assorted image formats (including sixel)

from terminal.gui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.