views:

26

answers:

1

I grow tired of carefully hand indented multi-line function arguments or logic statements being reformatted on cut/copy - paste operations.

i.e. code that started out like

LPCTSTR FoldersToIgnore[] = { _T("_Disk"),
                              _T("_Storage Card"),
                              _T(".Production-Archive"),
                              _T(".TCCSync-Archive"),
                              _T(".USBData-Archive"),
                              _T(".Production-Data")};

if (  (ItemName.CompareNoCase(FoldersToIgnore[i]) == 0) ||
      ( !Path.IsEmpty() && 
        Path.Left((int)_tcslen(FoldersToIgnore[i])) == 0))
{
  return false;
}

being reindented to

LPCTSTR FoldersToIgnore[] = { _T("_Disk"),
  _T("_Storage Card"),
  _T(".Production-Archive"),
  _T(".TCCSync-Archive"),
  _T(".USBData-Archive"),
  _T(".Production-Data")};

if (  (ItemName.CompareNoCase(FoldersToIgnore[i]) == 0) ||
  ( !Path.IsEmpty() && 
  Path.Left((int)_tcslen(FoldersToIgnore[i])) == 0))
{
  return false;
}

on pasting.

One can work around this effect by following every paste operation with a Ctrl-Z Undo, but it would be nicer if it didn't happen in the first place.

thanks

Richard.

A: 

Try unchecking the "Automatically format on paste" option in Tools -> Options -> Text Editor -> [Language] -> Formatting -> General where language is your current language (eg. C++, C#).

This is on VS2008 as I haven't got VS2005 in front of me at the moment - I think it is the same though.

adrianbanks
Hmmmm, I'm not seeing a "General" sub-setting or a "Automatically format on paste" option under Tools -> Options -> Text Editor -> C/C++ -> Formatting in either VS 2005 or 2008
Richard
Nor can I find any likely looking registry entry. Would you mind having a grub about on your system and posting the appropriate entry so i can have a try at manually hacking it into my boxThanks
Richard
You are correct - I've looked in my VS2005 and VS2008 and it appears that the option I mentioned is only there for C#. I don't however get the formatting on paste that you get with your example when in a C++ project so some setting/combination of settings must be settable to prevent it.
adrianbanks