Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control: Attributed Label #17

Open
migueldeicaza opened this issue Jan 11, 2018 · 1 comment
Open

Control: Attributed Label #17

migueldeicaza opened this issue Jan 11, 2018 · 1 comment

Comments

@migueldeicaza
Copy link
Collaborator

migueldeicaza commented Jan 11, 2018

To make it simpler to add a splash of color to the UI.

Some thoughts:

  • Attributed strings should allow overlapping attributes
  • Attributed strings should have an HTML-like input system for ease of creation.

Tags:

  • <b> - bold
  • <u> - underline
  • <r> - reverse

Colors:

  • <red>, <green>, <yellow> etc
@tig
Copy link
Collaborator

tig commented Jun 2, 2020

What about just supporting the ANSI Escape SGR parameters?

This way we don't have to invent new markup.

If we re-built Label on top of XTermSharp we'd get this mostly for free.

Related: #432 & #299

In my opinion we should do the following:

  • Implement a robust read-only text engine that supports:
  • left, right, center, justifiied justifiction
  • line wrap (both word and character based)
  • rendering ANSI color/formatting sequences
  • Put this text engine under Label

Use Label as a child control (or renderer) inside all other controls that display read-only text: Window.Title, MessageBox, TextField, etc...

@migueldeicaza has been doing work on a better text editor component for SwiftTerm. I suspect that work will not be useful to Terminal.Gui since it's probably tied to iOS. I think having a robust read-only text engine is more important that having BOTH that and an editor. And I'm not convinced they need to be based on the same thing (although one could argue that you'd read-only to just be a read-only version of edit.

(FWIW, I recently built an engine that comes close to this as part of https://github.com/tig/winprint. It doesn't support right, center, or justified and has lame word wrapping, but it DOES do ANSI formatting. It is based on https://github.com/rasmus-toftdahl-olesen/libvt100. I didn't know about @migueldeicaza's XtermSharp when I started, and XtermSharp doesn't support > 8bit color sequences, so I kept with libvt100. It's possible that one way to build this all is to simply layer it on top of XtermSharp or libvt100. I may build a POC of this.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: 🆕 Not Triaged
Development

No branches or pull requests

2 participants