Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with VS editor.

Problem with VS editor.

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++visual-studiotoolshelp
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jack Handy
    wrote on last edited by
    #1

    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

    J D 2 Replies Last reply
    0
    • J Jack Handy

      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

      J Offline
      J Offline
      Joe Woodbury
      wrote on last edited by
      #2

      Go to "File|Advanced Save Options..." For Line Endings select "Unix (LF)" Unfortunately, this applies only to the active file (note the singular).

      J 1 Reply Last reply
      0
      • J Joe Woodbury

        Go to "File|Advanced Save Options..." For Line Endings select "Unix (LF)" Unfortunately, this applies only to the active file (note the singular).

        J Offline
        J Offline
        Jack Handy
        wrote on last edited by
        #3

        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.

        J 1 Reply Last reply
        0
        • J Jack Handy

          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.

          J Offline
          J Offline
          Joe Woodbury
          wrote on last edited by
          #4

          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.)

          J 1 Reply Last reply
          0
          • J Joe Woodbury

            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.)

            J Offline
            J Offline
            Jack Handy
            wrote on last edited by
            #5

            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.

            J 1 Reply Last reply
            0
            • J Jack Handy

              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.

              J Offline
              J Offline
              Joe Woodbury
              wrote on last edited by
              #6

              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.

              J 1 Reply Last reply
              0
              • J Joe Woodbury

                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.

                J Offline
                J Offline
                Jack Handy
                wrote on last edited by
                #7

                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.

                J 1 Reply Last reply
                0
                • J Jack Handy

                  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

                  D Offline
                  D Offline
                  Daniel Turini
                  wrote on last edited by
                  #8

                  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)

                  1 Reply Last reply
                  0
                  • J Jack Handy

                    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.

                    J Offline
                    J Offline
                    Joe Woodbury
                    wrote on last edited by
                    #9

                    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.)

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups