Rich - under the hood #1937
-
Hey Will, I've been looking at Rich's code more closely. trying to get an idea how does it actually work "under the hood" - and I'm not sure I got it right, could you please clarify some doubts? Looking at Does this sound about right, or am I missing something? Is then the 'magic' in making fancy stuff like Thanks for your time! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hi Federico, Your assessment is accurate. Ultimately all the renderables will generate a sequence of Segments. The advantage of Segments is that they can be further processed. For instance the table can render something and process the segments to fit within the cells. It also makes it possible to target the output to either the console or HTML. It would be very difficult to do any of that if you generate text with embedded ansi escape codes. Will |
Beta Was this translation helpful? Give feedback.
-
Hi Will, I've recently started implementing some of rich's features in a julia library: https://github.com/FedeClaudi/Term.jl. |
Beta Was this translation helpful? Give feedback.
-
HI will, I hope all is well. I realize I'm asking, for your time to answer questions that are not strictly Rich related - so if you're busy please just ignore the following. As you know, I'm developing Term in Julia which implements some of Lately I've been re-working the progress bar functionality, and now the progress bars sit at the bottom of the terminal with any I can see a few options:
The last option is the most accurate, but it requires a bunch of work any time something is changed. So it doesn't test for bug just for changes. Any advice? |
Beta Was this translation helpful? Give feedback.
Hi Federico,
Your assessment is accurate. Ultimately all the renderables will generate a sequence of Segments.
The advantage of Segments is that they can be further processed. For instance the table can render something and process the segments to fit within the cells. It also makes it possible to target the output to either the console or HTML. It would be very difficult to do any of that if you generate text with embedded ansi escape codes.
Will