This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 4619 - Editor should allow you to view non-visible characters such as tabs, spaces, carriage returns, and EOF.
Summary: Editor should allow you to view non-visible characters such as tabs, spaces, ...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P4 enhancement with 60 votes (vote)
Assignee: issues@editor
URL:
Keywords:
: 58744 146275 153796 180882 (view as bug list)
Depends on:
Blocks: 179047 143309
  Show dependency tree
 
Reported: 1999-11-02 19:44 UTC by Jon Koplin
Modified: 2010-08-31 08:34 UTC (History)
10 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
font to show spaces (1.76 KB, application/x-font-ttf)
2010-04-23 09:16 UTC, tim_abell
Details
source for font (1.40 KB, application/vnd.font-fontforge-sfd)
2010-04-23 09:17 UTC, tim_abell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Koplin 1999-11-02 19:44:53 UTC
It would be nice to have an option which could turn this on as well as being able to customize the font used.

Along the same lines, the editor also needs a command to convert all of the tabs in a file to spaces and vice versa.  I know that there is an editor option to do this, but it only applies to code you
type in.  You should be able to load a file with tabs and convert them all to spaces with a menu command.  Finally, if the `convert tabs to spaces` option is on, then tabs should be converted to space
s even in code pasted from the clipboard.

Basically, I want to be able to keep tabs out of my source code and there are a number of factors that make this difficult.  The editor should take care of them all.
Comment 1 Marek Grummich 2000-07-25 09:10:59 UTC
Priority is changed to P4 (normal).
Comment 2 Jan Lahoda 2001-01-24 15:38:59 UTC
Only changed version to Development.
Comment 3 Jan Chalupa 2001-05-05 21:56:25 UTC
Target milestone -> 3.3
Comment 4 David Konecny 2001-05-22 15:34:28 UTC
Re-assigning issues back to the bugs@editor.netbeans.org
Comment 5 David Konecny 2001-05-22 15:50:25 UTC
Changing the state of the issue to ASSIGNED, because it was cover in 
Requirements document at http://editor.netbeans.org/doc/Requirements.html
Comment 6 Jan Chalupa 2001-11-27 12:28:01 UTC
Target milestone -> 3.3.1.
Comment 7 Marek Grummich 2002-07-22 09:55:28 UTC
Set target milestone to TBD
Comment 8 Marek Grummich 2002-07-22 09:58:21 UTC
Set target milestone to TBD
Comment 9 Roman Strobl 2004-12-07 14:54:03 UTC
Changing subcomponent to ui.
Comment 10 Vitezslav Stejskal 2009-05-11 12:38:42 UTC
*** Issue 58744 has been marked as a duplicate of this issue. ***
Comment 11 Vitezslav Stejskal 2009-05-11 12:38:58 UTC
*** Issue 146275 has been marked as a duplicate of this issue. ***
Comment 12 Vitezslav Stejskal 2009-05-11 12:39:05 UTC
*** Issue 153796 has been marked as a duplicate of this issue. ***
Comment 13 austvik 2009-05-11 13:02:18 UTC
please note that bug 153796 had 17 votes (and was therefore on the high-score list of most popular enhancements to fix)
before it was closed as a duplicate of this on.

There are lots of duplicates for this issue. Personally, highlighting whitespace *at end-of-line* is what I am looking for.
Comment 14 takeda 2009-05-11 17:26:14 UTC
I personally want to see all tabs and all spaces in some fashion that doesn't make them stand out (e.g. 
color similar to the background, but enough visibility to tell the difference between the tab and space.

I'm very OCD about it.

This is programming style I personally use, and seemed to work for me well, but requires to see the 
spaces/tabs (unless the editor would do it automatically which might be even better).

Basically I use tabs as indentation, but there are places where spaces are necessary, e.g. inside of 
comments, etc.

Here's an example:

int main () {
<T>printf("Hello \ //<SP><SP>A comment
<T><SP>world");<SP>//<SP><SP>block

<T>return 0;
}

Basically the tabs are ONLY on the left side.

The benefits of this, is that the code always looks well despite of the tab size. I can do it manually, 
but to do it, I have to see tabs and spaces.
Comment 15 Vitezslav Stejskal 2009-05-12 15:47:08 UTC
I'm sorry for losing the votes.
Comment 16 flying-sheep 2009-11-13 13:45:30 UTC
this bug is ooold, has many votes, the function requested is standard in just about every modern text editor. why is the target milestone always changed? how come that nobody fixed in _9_ years?

too bad i only use qt and have no intention to ever write anything in swing. in qt this function is done in only about 20-25 lines (that includes the checkbox-setting in the menu and the description of the vector graphic used to visualize a tab or a space. you can look at it in the kate sourcecode)
Comment 17 flying-sheep 2009-11-14 08:21:52 UTC
since i don’t think it is worked on (nobody needs 6-7 years to fix this) i change the status to “new” instead of started.

i know that the “convert tabs to spaces” part is implemented for a long time, but this is the root feature request every “higlight tabs and spaces” request is marked as dupe for. and nobody works on this, i’m sure.
Comment 18 poe9514 2009-11-14 10:53:36 UTC
If someone can help me get started on this, I'd be more than willing to contribute on this task.

Does anyone have an idea of where in the source to start?  I'm just not sure where the code for controlling the output of the source window is...
Comment 19 halmai 2009-11-14 20:13:39 UTC
I wish to toggle quite often between
ShowWhiteSpaces and HideWhiteSpaces mode. Therefore I would like to get a
hotkey as well for this switch, if it is possible. Thanks!

And yes, I am voting for this issue too.
Comment 20 Vitezslav Stejskal 2009-11-19 08:02:38 UTC
(In reply to comment #18)
> If someone can help me get started on this, I'd be more than willing to
> contribute on this task.
> 
> Does anyone have an idea of where in the source to start?  I'm just not sure
> where the code for controlling the output of the source window is...

org.netbeans.editor.DrawEngine and related classes.
Comment 21 Miloslav Metelka 2009-11-21 11:27:32 UTC
Please note that improvements in DrawEngine may go in vain due to new view hierarchy issue #121357.
Comment 22 3dd13 2010-01-16 20:17:41 UTC
*irony on*

Yeah! Basics are coming in version 6.9 or 7 or 8, well, maybe 9. Well, realistic target milestone will be 10. Wordwrap and show whitespace (arrows for tabs and dots for chars).

*ironie off*

Just voted. :-/
Comment 23 darkvamp1976 2010-02-05 10:49:16 UTC
Voted too
Comment 24 Vitezslav Stejskal 2010-02-18 07:17:08 UTC
*** Bug 180882 has been marked as a duplicate of this bug. ***
Comment 25 janicki 2010-02-18 08:15:30 UTC
Although the brute-force solution is to make all tabs/spaces visible as light grey arrows/dots, a more clever IDE might only make tabs/spaces visible where they aren't expected:

1. Spaces indenting lines in a normally tab-indented file, or tabs indenting a normally space-indented file.  

2. Any spaces or tabs trailing the ends of lines

3. Tabs whenever they appear in the middle of a line.  (I don't think there is any reason for them to (ever?) be used there.)

4. Two or more spaces in the middle of a line, except maybe within a string.


Anywhere else, tabs/spaces could be left invisible, to maintain readability.  However an option (in the View menu?) to force all tabs/spaces to be shown would be useful too.

Note, This might need to be coordinated with the existing "Format" tool, so that the editor and Format agree on what looks "unexpected".

<opinion>Netbeans has so many impressive editing features that the mere existence of this rather basic feature request seems odd.  Hopefully it can be given a greater priority.  These "intelligent" features are needed (expected?) in a source code editor... they set an IDE apart from a plain text editor, like 'vi'.  </opinion>
Comment 26 ericjs 2010-02-18 08:44:19 UTC
I think janicki's "highlight unexpected"feature (Comment #25) is a great idea. However I think it should be a part of language-specific highlighting built on top of whatever editor support is added to show non-visible spaces in the first place, with each option individually selectable, and independent of the editor-general show tabs & spaces / show line endings features. I think this should be a separate feature request.

(BTW, this may not be common, but some people DO use tabs mid-line to line up elements in their code, like multi-line comments that fall after code lines, variable names in a list of declarations, array. This may be more common in some languages than others.)
Comment 27 grantb 2010-02-18 08:54:31 UTC
I seconded ericjs's reply.

Let this bug just be about a basic show-non-visible-characters mode that can be used by everyone, no matter what the language or mode.
Comment 28 amites 2010-02-18 09:34:54 UTC
Given the age of this feature request for "basic" level support I don't see adding "nice to have" ideas as the best way to get it moving forward

seems there would be atleast 1 Java developer with a couple hours to come up with a way to implement this - adding in bells and whistles takes that couple hours and turns into a couple days which is far less likely...

just my 2 cents - anyone consider getting a pool of money together to contribute to anyone that fixes/adds a given bug/feature??

I know of a few web-sites that offer this feature though none pop into mind. I know I'm willing to offer $5 to anyone that adds this into Netbeans since it's one of a handful of annoyances that are near deal breakers (I'm still using it - just feels wrong not to have such a basic IDE feature)
Comment 29 Quality Engineering 2010-03-04 22:14:24 UTC
Integrated into 'main-golden', will be available in build *201003050200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/3ed1fede4c1b
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #4619: adding 'Show Non-printable Characters' action to 'View' main menu (note: it's disabled until #121357 is resolved)
Comment 30 Vitezslav Stejskal 2010-03-08 08:15:46 UTC
http://hg.netbeans.org/jet-main/rev/14e6506077de
Comment 31 Quality Engineering 2010-03-10 23:11:56 UTC
Integrated into 'main-golden', will be available in build *201003110200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/14e6506077de
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #4619: connecting 'Show Non-printing Characters' View menu item with the new view hierarchy
Comment 32 katsuke 2010-03-11 00:47:39 UTC
@ vstejskal@netbeans.org

thank you so much for working on this, its highly appreciated. I just ran the 201003110200 build, and the option of "Show Non-printing Characters" enables and disables correctly. Maybe am missing something here but, there is no changes what so ever on the editor regardless of the status on the item on the menu. Is there any extra options i need to setup? Or is only the item on the menu working and the "show/hide characters" on the editor is not implemented yet?

Sorry if it is something silly i missed, i just cant find a way to get it working. Thanks a lot again, this feature is very important for my work.

R
Comment 33 Vitezslav Stejskal 2010-03-11 06:05:21 UTC
(In reply to comment #32)
> ... Is there any extra options i need to setup?

I'm sorry, but the new view hierarchy is not stable enough and so it is turned off in the builds. Please be patient, we are working on it and will turn it on as soon as possible.
Comment 34 katsuke 2010-03-11 08:28:54 UTC
(In reply to comment #33)
> I'm sorry, but the new view hierarchy is not stable enough and so it is turned
> off in the builds. Please be patient, we are working on it and will turn it on
> as soon as possible.

Thank you for the quick response. I dis some digging and found the main bug for the new view hierarchy, anyone interested on the status of this keep an eye on the following: 

http://netbeans.org/bugzilla/show_bug.cgi?id=121357
Comment 35 tim_abell 2010-04-23 09:16:11 UTC
Created attachment 97902 [details]
font to show spaces

as a workaround i've created a font that has a visible character for space.

install the font, and set the whitespace font to this and you will then be able to tell tabs and spaces apart.
Comment 36 tim_abell 2010-04-23 09:17:10 UTC
Created attachment 97903 [details]
source for font

and here's the source file for the font. created with FontForge http://fontforge.sourceforge.net/
Comment 37 arharp 2010-06-10 21:23:48 UTC
The "Show Non-printable Characters" menu item is no longer available in 6.9 RC2.  Has this been abandoned for 6.9?  This is extremely basic and universal functionality for a text editor.  It would really be a shame if this got put off even longer.
Comment 38 Vitezslav Stejskal 2010-06-11 12:03:50 UTC
(In reply to comment #37)
> The "Show Non-printable Characters" menu item is no longer available in 6.9
> RC2.  Has this been abandoned for 6.9?

Yes. The new view hierarchy was not in good enough quality for the release. See details in issue #121357.
Comment 39 David Strupl 2010-08-20 14:20:41 UTC
This has been added for 6.10 - it is now in dev builds and should be part of 6.10 M1 - and 6.10 release if everything goes well.
Comment 40 arharp 2010-08-20 19:28:12 UTC
Thanks so much to everyone who worked on this!  I noticed one small problem.  HTML doesn't seem to pay attention to the color specified for whitespace.  Is this something that can be easily fixed?
Comment 41 Michel Graciano 2010-08-20 19:34:09 UTC
Please file a separated issue agains it. Thanks
Comment 42 Kiena 2010-08-28 07:00:39 UTC
Two issues I noticed in 6.10m1 so far (both explicitly mentioned in the title):
1. Carriage returns are not displayed. They may be important e.g. in scripts for tools that handle them incorrectly. For finding such problems another editor would be needed.
2. After the last line an EOL symbol is shown, instead of EOF (or possibly nothing). This is misleading, and may hide why the last line is being ignored or the entire file is being rejected.

Should it be reopened or marked incomplete until these get implemented?
Comment 43 David Strupl 2010-08-31 08:34:35 UTC
In response to Comment #42: No, please log 2 new separate issues for each of the mentioned problems. Thanks.