Problem with VS editor.
-
When you hit the enter key in VS6 it inserts "\r\n" which drops you down a line. This is normal behavior in windows, however I'm editing C++ files that are being used in unix and the \r is an annoyance there. My question is, does anyone know how to stop VS from inserting the \r -or- Is there a way to run a small script that would strip this out when you save the file? -Jack
-
When you hit the enter key in VS6 it inserts "\r\n" which drops you down a line. This is normal behavior in windows, however I'm editing C++ files that are being used in unix and the \r is an annoyance there. My question is, does anyone know how to stop VS from inserting the \r -or- Is there a way to run a small script that would strip this out when you save the file? -Jack
Go to "File|Advanced Save Options..." For Line Endings select "Unix (LF)" Unfortunately, this applies only to the active file (note the singular).
-
Go to "File|Advanced Save Options..." For Line Endings select "Unix (LF)" Unfortunately, this applies only to the active file (note the singular).
Is this in VC++ 6.0 ? Because I don't see "Advanced Save Options" under the File menu. Thanks, Jack
There are 10 types of people in this world, those that understand binary and those who don't.
-
Is this in VC++ 6.0 ? Because I don't see "Advanced Save Options" under the File menu. Thanks, Jack
There are 10 types of people in this world, those that understand binary and those who don't.
Sorry, I was thinking VC7. I don't believe there is a solution in VC6 except to write a little program. (In fact VC6 will take files that have just LF and convert them automatically to CR/LF. By default, VC7 will preserve the original style.)
-
Sorry, I was thinking VC7. I don't believe there is a solution in VC6 except to write a little program. (In fact VC6 will take files that have just LF and convert them automatically to CR/LF. By default, VC7 will preserve the original style.)
Mine seems to be preserving the original style. It only inserts the \r when I add a line. Do you happen to know if it is possible to write a little script/program and have it be ran on the file when you hit save? Like a filter or something. -Jack
There are 10 types of people in this world, those that understand binary and those who don't.
-
Mine seems to be preserving the original style. It only inserts the \r when I add a line. Do you happen to know if it is possible to write a little script/program and have it be ran on the file when you hit save? Like a filter or something. -Jack
There are 10 types of people in this world, those that understand binary and those who don't.
There is an event to tell you a document has been saved, but I don't think there is the ability to do what you want. One solution would be to write an add-in and call it directly.
-
There is an event to tell you a document has been saved, but I don't think there is the ability to do what you want. One solution would be to write an add-in and call it directly.
Ok, Thanks for your help. Would you happen to know how to access this event? I wouldn't mind writing a program that cleans up the file right after each save. -Jack
There are 10 types of people in this world, those that understand binary and those who don't.
-
When you hit the enter key in VS6 it inserts "\r\n" which drops you down a line. This is normal behavior in windows, however I'm editing C++ files that are being used in unix and the \r is an annoyance there. My question is, does anyone know how to stop VS from inserting the \r -or- Is there a way to run a small script that would strip this out when you save the file? -Jack
If you are working with Unix and Windows at the same time, I recommend you installing Cygwin[^]. One of their utilities is u2d and d2u (Unix to Dos/Dos to Unix), which make the conversion you need. I know that installing Cygwin just for this is overkill, but I think you should give it a try, since it can really ease when you are working with multiplatform code.
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
-
Ok, Thanks for your help. Would you happen to know how to access this event? I wouldn't mind writing a program that cleans up the file right after each save. -Jack
There are 10 types of people in this world, those that understand binary and those who don't.
Check out the add-in documentation. You probably could also do this as a macro, but I don't remember how (the last Visual Studio macro I wrote was three years ago.)