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

Shouldn't smartcase match the case of replaced? #314

Open
kasbah opened this issue Mar 25, 2024 · 2 comments
Open

Shouldn't smartcase match the case of replaced? #314

kasbah opened this issue Mar 25, 2024 · 2 comments

Comments

@kasbah
Copy link

kasbah commented Mar 25, 2024

Hello! I love sad! In the README it says:

By default, sad uses smartcase,

To me this would mean that:

Bye

bye

and sad bye goodbye

would become

Goodbye

goodbye

but it actually becomes:

goodbye

goodbye

Is this intended? Maybe it should be clarified in the the README?

@daniejstriata
Copy link

daniejstriata commented May 13, 2024

I also thought that the case will be preserved. It does make sense for the final case to be the replacement value. Changing with the following example makes it a bit more confusing

fd test1.sh | sad -e goodbye bye
-goodbye
-Goodbye
+bye    
+bye
fd test1.sh | sad -e Goodbye bye
 goodbye
-Goodbye
+bye

where sad -fI -e goodbye bye

-goodbye 
+bye     
 Goodbye 

should there be an option to preserve case using smartcase default? Maybe but it should not be the default behaviour. The intended change should by default end-up with the exact replacement value as it was given.

@kasbah
Copy link
Author

kasbah commented May 13, 2024

It does make sense for the final case to be the replacement value.

Isn't that more accurately described as a case-insensitive replacement rather than smart case though?

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

No branches or pull requests

2 participants