Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / October 2004

Tip: Looking for answers? Try searching our database.

Is it possible to remove trailing white spaces when saving?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Neo The One - 11 Oct 2004 12:37 GMT
I use UltraEdit a lot. One of my favorite feature about it is that it can
trim all trailing white spaces when saving or on the fly to selected lines.

Perhaps it is because the auto-indent thing, the VS.NET IDE editor
constantly adds useless white spaces while editing. (VS 6.0 editor does so
too). This is not a big issue, but I just can't get rid of the idea that so
many garbage white spaces lurking in my source files.

So here is a question for Microsoft guys. Is there any plan to address this
small problem?
Scott M. - 11 Oct 2004 16:26 GMT
>I use UltraEdit a lot. One of my favorite feature about it is that it can
> trim all trailing white spaces when saving or on the fly to selected
> lines.

You are using UltraEdit instead of VS.NET for editing your .NET work?!

> Perhaps it is because the auto-indent thing, the VS.NET IDE editor
> constantly adds useless white spaces while editing. (VS 6.0 editor does so
> too). This is not a big issue, but I just can't get rid of the idea that
> so
> many garbage white spaces lurking in my source files.

The white space inserted is to keep the indenting of the code in place so
that the code is human readable.  The white space has no effect whatsoever
on performance, so I think you should just learn to live with it.

> So here is a question for Microsoft guys. Is there any plan to address
> this
> small problem?

I don't think most people consider this a problem.
Len Philpot - 12 Oct 2004 00:05 GMT
> >I use UltraEdit a lot. One of my favorite feature about it is that it can
> > trim all trailing white spaces when saving or on the fly to selected
> > lines.
>
> You are using UltraEdit instead of VS.NET for editing your .NET work?!

I think the OP was just commenting on the relative capabilities of
each. I think if he was using UE for .NET coding, he'd not be asking
how to do this in VS. :-)


> > Perhaps it is because the auto-indent thing, the VS.NET IDE editor
> > constantly adds useless white spaces while editing. (VS 6.0 editor does so
> > too). This is not a big issue, but I just can't get rid of the idea that
> > so
> > many garbage white spaces lurking in my source files.

If it's trailing space that's being discussed, a regex search of
'[ \t]*$' can be replaced with (nothing) to remove trailing spaces
and tabs. Tie it to a macro and it can be done quickly.

Signature

-- Len Philpot -> len@philpot.org     <--
------ ><> -----> http://philpot.org/ <--

Neo The One - 12 Oct 2004 04:35 GMT
It is a little difficult to put this clear. If you do a Select All in a
source file in VS IDE and observe carefully you will certainly notice that
there are lines with only one or more TABs. These TABs are added when you try
to add something and later you remove the something; however, the leading
TABs as indentation are left and now they are the only thing on that line.

Do you get what I am explaining?

> >I use UltraEdit a lot. One of my favorite feature about it is that it can
> > trim all trailing white spaces when saving or on the fly to selected
[quoted text clipped - 17 lines]
>
> I don't think most people consider this a problem.
Scott M. - 12 Oct 2004 15:33 GMT
Yes, I get what you are saying and what I'm saying is that it does not cause
any problems at all.  You may not like it, but it's not something that you
have to worry about.

> It is a little difficult to put this clear. If you do a Select All in a
> source file in VS IDE and observe carefully you will certainly notice that
[quoted text clipped - 30 lines]
>>
>> I don't think most people consider this a problem.
Robin - 15 Oct 2004 14:59 GMT
"=?Utf-8?B?TmVvIFRoZSBPbmU=?=" <NeoTheOne@discussions.microsoft.com>
wrote in news:36BF5474-4522-4335-AC56-245338DE7CC9@microsoft.com:

> So here is a question for Microsoft guys. Is there any plan to address
> this small problem?

The default macro project has a FixLineEnds macro. So you can create
another macro which calls it. Just select the file and run the macro

   ' Removes all trailing white spaces and tabs
   Sub FixLineEndsAll()

       With ActiveDocument.Selection

           Dim tp As VirtualPoint = .AnchorPoint

           Dim col = tp.DisplayColumn
           Dim row = tp.Line

           .SelectAll()
           FixLineEnds()

           .MoveToDisplayColumn(row, col)

       End With
Neo The One - 15 Oct 2004 20:25 GMT
Thanks, I discovered that too. But it is very slow on large files with many
lines of code.

I just want find out that the white spaces only are added in C/C++/C# files.
VB.NET code editor does not have this problem. It seems VB.NET editor is much
smarter. When I delete the only non-whitespace char on a line, it will
automaticcally remove the remaining white spaces. That's cool.

I hope this feature will be available in other code editors and also hope
Microsoft guys can hear my voice.

> "=?Utf-8?B?TmVvIFRoZSBPbmU=?=" <NeoTheOne@discussions.microsoft.com>
> wrote in news:36BF5474-4522-4335-AC56-245338DE7CC9@microsoft.com:
[quoted text clipped - 21 lines]
>
>         End With

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.