开发者

Anyone know how to stop Visual Studio 2005 editor formatting inserted text on a paste operation?

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.

tha开发者_高级运维nks

Richard.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜