Skip to content

Rethink the terminal emulator library termemu #415

@klange

Description

@klange

We have a library, libtoaru_termemu, that provides some basic escape sequence parsing. At one point, it was used in the kernel, but these days it is only used in our two terminal emulator frontends: terminal and terminal-vga (the header is also included in two other apps since it exposes... the default opacity of the background?

termemu is very limited. It only provides parsing. It is also heavily callback-driven, but the callbacks don't carry a context with them, so they can only feasibly be used from a single terminal. Both terminal and terminal-vga implement the rest of the terminal - cell management, drawing, key conversion, and even handling of most special characters outside of escape sequences. This results in a lot of duplication of code between the two, and, worse, missing functionality in terminal-vga.

Since we no longer use termemu in the kernel, this design limitation isn't necessary. Applications should only need to deal with getting input to the terminal "widget", and ensuring it can be rendered out somehow.

  • termemu should have everything needed to manage a terminal besides actually drawing it to a screen.
  • A new library, termemu-gfx should provide a wrapper around this new termemu that can manage rendering to a gfx_context_t.
  • terminal should do very little beyond providing menus and routing input to the above library.
  • terminal-vga should use termemu directly and be able to render out state to the VGA text mode buffer.
  • termemu should be more strictly built around supporting multiple terminal instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions