Skip to content

Conversation

@wpkelso
Copy link
Member

@wpkelso wpkelso commented May 14, 2025

image
image

Introduces a TerminalView widget that

Also:

  • Switches message dialog to use this new widget
  • Moves Terminal View to it's own page in the demo app

Future extensions

  • Include option to automatically tie to stdout or stderr
  • Support ANSI graphics and color escape codes

@wpkelso wpkelso requested a review from danirabbit May 15, 2025 19:53
@wpkelso wpkelso removed the request for review from danirabbit May 16, 2025 16:30
@wpkelso wpkelso marked this pull request as ready for review May 20, 2025 18:49
@wpkelso wpkelso requested a review from danirabbit May 20, 2025 18:49
@wpkelso wpkelso requested a review from danirabbit June 10, 2025 19:09
@stsdc
Copy link
Member

stsdc commented Jun 11, 2025

If it's possible with this widget, maybe it would be worth to show colour palette?

Small snippets on how to archive those colours. e.g. for [PASS], [FAIL], [WARNING].

@wpkelso
Copy link
Member Author

wpkelso commented Jun 11, 2025

If it's possible with this widget, maybe it would be worth to show colour palette?

Supporting ANSI Graphics/Color escape codes would be useful. However, I don't know whether it would be better to delay this PR to add that support, or to include that support in a follow-up.

—Edit:
Thinking further on it, this is probably better in a follow-up. At minimum (thinking out loud), I expect this would require a fully defined TextTagTable, some reworking of the stylesheet to allow us to actually apply foreground colors, and some mechanism to apply the tags.

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't think this should be a public widget. The previous style class was really only used in MessageDialogs, it wasn't supposed to be a style that app developers were using regularly. So personally I'm -1 on this altogether. This isn't something I think we should be doing or supporting.

Tbh even in MessageDialogs it's been a bit of an antipattern. People have been really bad about not reading these messages, even when reporting an issue they won't expand the terminal view. So I'm kind of in favor of removing this feature altogether in a future version of MessageDialog and forcing developers to write some better error handling

*/

[Version (since = "7.7.0")]
public class Granite.TerminalView : Granite.Bin {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs documentation. See some of the other widgets for an example. Just needs a simple description of what this widget is and what it's used for

Comment on lines +290 to +294
/**
* Internal style class for {@link Granite.TerminalView} to emulate the appearance of Terminal. This includes
* text color, background color, selection highlighting, and selecting the system monospace font.
*/
internal const string TERMINAL = "terminal";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be added as a constant here. We usually don't make constants for things that aren't used outside of their own class

};

child = scrolled_window;
add_css_class (Granite.CssClass.TERMINAL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding a style class, this should be the css name. Right now you have css nodes like widget.terminal but it should just be terminal So you need to remove this css class and add something like:

    class construct {
        set_css_name ("terminal-view");
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants