Skip to content

Conversation

@hadley
Copy link
Member

@hadley hadley commented Oct 6, 2025

  • Fix lengths() typo
  • Handle case where we remove first line of new item
  • Add some tests

Fixes #2249

* Fix `lengths()` type
* Handle case where we remove first line of new item
* Add some tests

Fixes #2249
@claude
Copy link

claude bot commented Oct 6, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

@hadley hadley merged commit eb51b50 into main Oct 6, 2025
13 checks passed
@hadley hadley deleted the show-text-lengths branch October 6, 2025 20:22
Comment on lines +183 to +185
if (first[max_lines + 1]) {
max_lines <- max_lines - 1
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be misreading this, but I would have expected

Suggested change
if (first[max_lines + 1]) {
max_lines <- max_lines - 1
}
if (first[max_lines]) {
max_lines <- max_lines - 1
}

to avoid output like this (assuming max_lines = 2)

[1] | x
    | y
[2] | ...
... and 1 more.

i.e. I was thinking this we'd prefer to show an item only if you see at least one line, e.g.

[1] | x
    | y
... and 2 more.

whereas using first[max_lines + 1] gives

[1] | x
    | ...
... and 2 more

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh, I worked it out. + 1 is right

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

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.

show_text() logic problem

3 participants