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

Add skip package, which performs the inverse of truncate. #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qualidafial
Copy link

  • Add skip.Writer, skip.NewWriter, and skip.NewWriterPipe.
  • Add helper functions skip.String, skip.StringWithPrefix, skip.Bytes, and skip.BytesWithPrefix.
  • Add README section for both the truncate and skip packages.

Similar to the truncate package's "tail" parameter, the skip package supports a prefix parameter which can be used to provide a visual indication of horizontal scrolling.

The skip package is a crucial building block for supporting horizontal scrolling of a viewport, as well as UI compositing e.g. to overlay a modal dialog over the TUI behind it.

I have a working prototype for TUI compositing using this package, and hope to contribute it to charmbracelet/lipgloss once I've cleaned it up some.

* Add skip.Writer, skip.NewWriter, and skip.NewWriterPipe.
* Add helper functions skip.String, skip.StringWithPrefix,
  skip.Bytes, and skip.BytesWithPrefix.
* Add README section for both the truncate and skip packages.
@jdbann
Copy link

jdbann commented Apr 23, 2024

The skip package is a crucial building block for supporting horizontal scrolling of a viewport, as well as UI compositing e.g. to overlay a modal dialog over the TUI behind it.

I wish I had checked open PRs before putting my own version of this together for exactly the same reason last night!

@qualidafial
Copy link
Author

@muesli Hi Christian! Would you mind reviewing this when you have a moment? I've tried to match this PR closely to the coding styles in Reflow's other packages, so hopefully it will be a straightforward review. Cheers!

@qualidafial
Copy link
Author

Ping?

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.

2 participants