charmbracelet / bubbletea

A powerful little TUI framework 🏗
MIT License
27.24k stars 788 forks source link

feat: Synchronized output #1027

Open nervo opened 4 months ago

nervo commented 4 months ago

This is an attempt to implement synchronized output in bubbletea. At this time, this is so naive, that you can see it as a proof-of-concept :)

Anyway, this does not break on my machine 👍

Some interesting reading:

Feel free to comment ❤️

vito commented 3 months ago

Friendly poke to whoever can keep this moving, could really use this for my TUI as it flickers pretty heavily on certain terminals. Cool to see a PR up for it already! 😄

nervo commented 3 months ago

@vito do you think you can give a try ?

Dear maintainners, are you ok with the way the feature is implemented (wording of methods and variables) ?

For the feature itself, i'm not an ansi guru, i just need to know:

  1. if i made the terminal query the good way
  2. If i understood the protocol correctly (the event.Value 2 or 4)
  3. if i'm doing the right things: sending the enable code just before, and the disable code right after writing the buffer, both independently from the buffer itself.
meowgorithm commented 3 months ago

Hey @nervo! Thanks for looking into this one, it's something we've very much been wanting to get in.

API aside, the big thing that will need to happen for this feature to work is an implementation at the renderer level so that Bubble Tea can repaint in-step with the terminal. We're currently working on an overhaul to the renderer, so we should hold off on this until we've made that update.

nervo commented 3 months ago

@meowgorithm ok, good to hear 👍