Git Product home page Git Product logo

Comments (9)

meowgorithm avatar meowgorithm commented on July 17, 2024 1

Just a note that this is now in master (via #249) and will be available in the next release.

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

This is a good one definitely a feature we’d like to support, however to do so we’ll need to add some additional functionality to both to the renderer as well as probably a special Cmd for unmanaged output.

Anyway, this should be a fun one. We’ll keep this issue updated with progress.

from bubbletea.

rfc2119 avatar rfc2119 commented on July 17, 2024

Thanks for your input @meowgorithm ! If there's anything I can help with, please do not hesitate to ask. I will try to help as much as I can

from bubbletea.

Adjective-Object avatar Adjective-Object commented on July 17, 2024

I have a working approach to this. Right now I have it set up as a separate renderer for the sake of simplicity, and because the "AltScreen" mode is incompatible with the "log mode" @rfc2119 proposed, so putting them on the same object would require handling incompatible setup options.

Changes to expose the renderer: #246
The renderer: https://github.com/Adjective-Object/tea_log_renderer/blob/main/tea_log_renderer.go

Happy to PR this in @meowgorithm. If you're ok with this approach, let me know if you'd prefer the to keep the Renderer internal and I can make this a feature flag on the standard renderer.

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

Thanks for the info (and the PR!), @Adjective-Object. I'm inclined to keep the rendering interface internal for now as it (somewhat intentionally) hasn't been given the attention necessary for a public API. However, at a glance, your implementation seems to make sense.

Would you be interested in submitting a PR against the standard renderer instead? I've been imagining the public interface as a Cmd or two, perhaps something like:

// A command for printing above the output, with a final newline
func Println(...string) Msg

// A command for printing above the output, probably also with a newline (somewhat like log.Print)
func Printf(string, vars ...string) Msg

I'd also probably leave word-wrapping as an exercise for the user, but open to your opinions here.

Let me know what you think!

from bubbletea.

Adjective-Object avatar Adjective-Object commented on July 17, 2024

from bubbletea.

Adjective-Object avatar Adjective-Object commented on July 17, 2024

Is there a convenient place for consumers to get access to the widthe of the terminal for word wrapping themselves? Otherwise it might actually make sense as an option when calling Println / Printf, for ergonomics

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

Is there a convenient place for consumers to get access to the widthe of the terminal for word wrapping themselves? Otherwise it might actually make sense as an option when calling Println / Printf, for ergonomics

Yep, via a WindowSizeMsg, which is sent to update once on initialization and for window resizes.

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

What do you think the behaviour of the Println() Cmd should be when in AltScreen mode?

I’d simply not print anything and note in the doc comment that Printf/Println won’t work when the altscreen is active..

from bubbletea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.