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

Expose TotalLineCount() and VisibleLineCount() methods within viewport #283

Merged
merged 1 commit into from
Nov 7, 2022

Conversation

adaam2
Copy link
Contributor

@adaam2 adaam2 commented Nov 3, 2022

As per discord discussion, exposes a TotalLineCount() and VisibleLineCount() methods in the viewport package.

@meowgorithm
Copy link
Member

meowgorithm commented Nov 4, 2022

Thanks, @adaam2. Per the discussion:

Is there a particular reason why lines in viewport is not accessible outside of the package? I have found myself in a situation where it would be helpful to know how many lines there currently are in a viewport - hidden or visible:

Don't think there's a method currently that allows you see the total number of lines - scroll percent is the nearest thing

Just curious about your use case here: is there a particular reason you need the actual lines versus just the total number? Was assuming this PR would be something closer to something like this:

func (m Model) TotalLineCount() int

func (m Model) VisibleLineCount() int

viewport/viewport.go Outdated Show resolved Hide resolved
@adaam2
Copy link
Contributor Author

adaam2 commented Nov 4, 2022

@meowgorithm yeah I'd be happy with just the totals - figured the actual content of the lines may have been more useful for others going forward (maintaining snapshots of content etc, but then again could just capture that in other ways just as easily)

I'll change the PR unless you have had a change of heart.

viewport/viewport.go Outdated Show resolved Hide resolved
viewport/viewport.go Outdated Show resolved Hide resolved
@meowgorithm
Copy link
Member

@adaam2 Thank you! For now, let's just stick with the totals. Just a couple small requests, then we're good to go with this one.

@adaam2 adaam2 changed the title Expose Lines() method within viewport Expose TotalLineCount() and VisibleLintCount() methods within viewport Nov 4, 2022
@adaam2
Copy link
Contributor Author

adaam2 commented Nov 4, 2022

@meowgorithm updated 👍🏻

@adaam2 adaam2 changed the title Expose TotalLineCount() and VisibleLintCount() methods within viewport Expose TotalLineCount() and VisibleLineCount() methods within viewport Nov 4, 2022
@meowgorithm
Copy link
Member

Looks good. Thank you!

@meowgorithm meowgorithm merged commit fac7a01 into charmbracelet:master Nov 7, 2022
ReallyLiri pushed a commit to ReallyLiri/bubbles that referenced this pull request Jun 13, 2024
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