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

Trim leading whitespace-only lines #7555

Merged
merged 1 commit into from
Jan 23, 2025
Merged

Trim leading whitespace-only lines #7555

merged 1 commit into from
Jan 23, 2025

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Jan 23, 2025

This adds trimming of leading whitespace-only lines to posting.

The goal is to reduce cases where people accidentally linebreak before their replies.

This doesn't break ASCII art — we don't trim whitespace on leading lines that contain non-whitespace characters.

Test Plan

Read the regex, convince yourself it's correct.

Try cases like this:

 
    

  test
test
  test  
  

Expected output:

  test
test
  test

@arcalinea arcalinea temporarily deployed to trim-nl - social-app PR #7555 January 23, 2025 01:15 — with Render Destroyed
Copy link

Old size New size Diff
6.97 MB 6.97 MB 34 B (0.00%)

Copy link
Collaborator

@pfrazee pfrazee left a comment

Choose a reason for hiding this comment

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

Tested the regex, LGTM

@gaearon gaearon merged commit 16abe45 into main Jan 23, 2025
7 checks passed
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.

3 participants