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

Support full per-cell SGR styling in all text #4

Open
2 of 5 tasks
japhb opened this issue Nov 12, 2023 · 7 comments
Open
2 of 5 tasks

Support full per-cell SGR styling in all text #4

japhb opened this issue Nov 12, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@japhb
Copy link
Owner

japhb commented Nov 12, 2023

Based on discussions in #3 .

At the moment, in most places in Terminal::Widgets where ANSI SGR styling can be applied, full lines of text (or even entire widgets) can only have one style, but in the future it should be possible to apply arbitrary spanwise styling, including down to the level of styling individual terminal display cells.

Necessary prerequisite bits:

  • Define classes/data structures for specifying spanwise styling
  • Upgrade low-level drawing calls to handle styled spans efficiently (as well as still handling plain strings)
  • Define fluent interface for describing styling in code
  • Define markup interface for describing styling for translated strings
  • TESTS
@japhb japhb added the enhancement New feature or request label Nov 13, 2023
@patrickbkr
Copy link

Quick note that I'm interested in this too, as the TUI debugger I just started working on will want marked up text all over the place.

@japhb
Copy link
Owner Author

japhb commented Mar 29, 2024

Yeah, it's an active member of the short list. At the moment I'm figuring out how to do scrollable regions without killing performance or wasting a pile of memory, but there's overlap between the two projects, because we want the combination of span styling and scrollable areas to also be reasonably efficient. Otherwise scrolling around in a long heavily marked up text file (e.g. module source) is going to suck.

In the mean time, a status update:

I've marked the first task in this issue as done, based on https://github.com/japhb/Terminal-Widgets/blob/main/lib/Terminal/Widgets/SpanStyle.rakumod and https://github.com/japhb/Terminal-Widgets/blob/main/lib/Terminal/Widgets/ColorTheme.rakumod .

I've also marked the third task done, because I think https://github.com/japhb/Terminal-Widgets/blob/main/examples/form.raku#L40-L65 is Good Enough For Now. ™️

@patrickbkr
Copy link

Sounds great! Thanks for all the work you put into this. T::W is bit by bit turning into an epic piece of software. :-D

@japhb
Copy link
Owner Author

japhb commented Apr 1, 2024

Major progress on my last comment; the following new files -- plus some miscellaneous bugfixes and cleanups -- implement scrollable span-highlighted buffers, and the scrollbars to go with them:

I also rewrote Viewer::Log based on SpanBuffer, and at HEAD the form example now supports arbitrary scrolling of the span-colored logs.

@japhb
Copy link
Owner Author

japhb commented Apr 1, 2024

Terminal::Widgets 0.1.5 now released with these changes.

@patrickbkr
Copy link

Wow, that was fast. Thanks! Now it's on me to actually make use of the new features!

@japhb
Copy link
Owner Author

japhb commented Apr 1, 2024

Please do let me know what you need next -- a GH issue is fine -- or if you run into any issues with what I've done so far. :-)

@japhb japhb self-assigned this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants