Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VS Text Edtior question

Status
Not open for further replies.

cheer8923

Programmer
Aug 7, 2006
230
US
I am not sure if this is the right place. If not, please let me know where to put it.

I am new to VS. Is there any way to disable the re-formating on pasted text? VS formatting is not ideal and I want it to be disabled.

Thanks!
 
Which VS are you using - lots of flavours and they keep their editor stuff in different places.

One thing you could do is to switch off smart indentation in the C++ editor. The location of the switch is different for VC6 and VC200x.
 
What is Visual Studio doing that you don't like?
For C++ code, VS seems to indent everything perfectly for me.
 
Try Tools/Options/Text Editor
Then you have a choice of

General
All languages/Tabs - indentation is done here
C/C++/Tabs - indentation is also done here

If you select Indenting/none, then it will paste as-is. If it is set to smart, the layout will be changed.

I've found it never does procedure parameters the way I like it. In fact, it is totally inconsistent. But then again, everyone is different. Some people actually like the totally inconsistent indentation scheme.

 
Our coding convention is the following:

void foo()
{
if (true)
{
bar(arg1, arg2,
arg3, arg4);
}
}

With indent brace set, VS will do

void foo()
{
if (true)
{
bar(arg1, arg2,
arg3, arg4);
}
}

I had to format things manually. When I copy and paste, I do NOT want it to automatically reformat.

I don't see the option to turn that off. Anyone?
 
Instead of reindenting, try this

Tools->Options
Text Exitor->C/C++->Formatting
Tick Indent Braces

Close it, then Ctrl-A, Ctrl K, Ctrl F or, if you have VS6 controls, Ctrl-A, Alt-F8.
 
That's what I have. However, I do NOT want re-format the pasted code.
 
In that case

Tools->Options
Text Editor->C/C++->Tabs->Indenting->None
 
Block seems to work better (newline is auto-indented).

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top