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

[Enhanced code blocks] Copy button should not omit lines with no text by default #222

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

seshrs
Copy link
Member

@seshrs seshrs commented Nov 9, 2022

Fixes #221.

The bug is kind-of embarrassing. When you click the "copy" button, we run a "mapping" function on each line that determines what text should be copied.
I forgot that if a line was empty, the mapping function would retun an empty string, which is "falsy" according to the Boolean test. I really should have explicitly checked that the map function's return value is not nullish before excluding it from the copied text. 😅

@seshrs seshrs added the semver/patch Pull Request proposes "patch" change label Nov 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2022

The spec from this PR is available at https://preview.sesh.rs/previews/eecs485staff/primer-spec/222/.

(Available until Fri Dec 09 2022.)

@seshrs seshrs merged commit ffd1019 into develop Nov 9, 2022
@seshrs seshrs deleted the fix-copy-btn branch November 9, 2022 05:58
seshrs added a commit that referenced this pull request Nov 9, 2022
… by default

Fixes #221. This commit duplicates the work of #222 in the main branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch Pull Request proposes "patch" change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant