Stop adding ^M characters

1,651 views
Skip to first unread message

Arthur Goldberg

unread,
Apr 4, 2021, 7:07:47 PM4/4/21
to BBEdit Talk
According to `git diff`,  control-M characters appeared at the ends of all lines I inserted in a file I'm editing with BBEdit. See screenshot.

How do I stop doing this?

Thanks
Arthur

ctrl-M.jpg

TJ Luoma

unread,
Apr 4, 2021, 7:48:01 PM4/4/21
to BBEdit MailingList
I believe those are line endings for Windows line-endings.

When editing a file, see if you see "Windows (CRLF)" at the bottom of the window 'chrome'.

If so, click on it and change it to "Unix (LF)".

Git will be happier then.


--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/03da91e3-e71f-43b9-aef8-c28f47ef5ac0n%40googlegroups.com.

David Kelly

unread,
Apr 4, 2021, 9:33:11 PM4/4/21
to bbe...@googlegroups.com

On Apr 4, 2021, at 6:07 PM, Arthur Goldberg <artgo...@gmail.com> wrote:

According to `git diff`,  control-M characters appeared at the ends of all lines I inserted in a file I'm editing with BBEdit. See screenshot.

How do I stop doing this?

Original Apple/Mac convention was <CR> (Control-M) line endings. 
Unix used <LF> (Control-J) line endings. 
CP/M and Windows used <CR> <LF> line endings.


BBEdit is pretty smart about continuing to use whatever it finds. Has a default for new files. 

--
David Kelly N4HHE, dke...@HiWAAY.net
============================================================
Whom computers would destroy, they must first drive mad.

Sam Hathaway

unread,
Apr 5, 2021, 10:20:25 AM4/5/21
to bbe...@googlegroups.com

If you use Git to collaborate with Windows users, there is some additional complexity to consider:

https://www.edwardthomson.com/blog/git_for_windows_line_endings.html

Cheers,
-sam

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.

Arthur Goldberg

unread,
Apr 6, 2021, 7:35:31 PM4/6/21
to BBEdit Talk
Thanks everyone. Yes, this only happens with some files, and always with them. 

I have followed the Git for Windows: Line Endings advice, creating .gitattributes.

I don't "see "Windows (CRLF)" at the bottom of the window 'chrome'."  I'm editing Python & see this:
BBEdit problem.jpg

Bruce Van Allen

unread,
Apr 6, 2021, 7:49:07 PM4/6/21
to BBEdit Talk
On 6 Apr 2021, at 16:31, Arthur Goldberg wrote:

> I don't "see "Windows (CRLF)" at the bottom of the window 'chrome'." I'm
> editing Python & see this:

Preferences -> Appearance -> Text status bar items: _√_ Text Encoding

Thanks,

- Bruce

_bruce__van_allen__santa_cruz__ca

Arthur Goldberg

unread,
Apr 8, 2021, 9:16:27 AM4/8/21
to BBEdit Talk
Thanks Bruce

I fixed it. Now I can change lines without 'git diff' complaining about bad line endings!

The setting is actually
Preferences -> Appearance -> Text status bar items: _√_ Line break type

Regards
Arthur
Reply all
Reply to author
Forward
0 new messages