Show control characters in Netbeans 6.5 - netbeans

Is it possible, to show control characters in NetBeans 6.5?
Like carrige return, spaces or tabs etc.
I searched for it in each menupoint but didn't find an option for that.

Check this: View -> Show Non-printable Characters

For this version of Netbeans this feature does not exist. The best thing you / I can do is useing the search to find spaces or tabs. Netbeans will mark them.

Related

Show non-print characters in NetBeans less vividly

NetBeans has an option to show non-printable characters, but they are shown with the same vividness as printable characters. This means that a space and a dot are very hard to distinguish: the space is slightly raised, but otherwise visually identical. Many other code editors, and even Gedit, will show non-printing characters greyed out. Is there an option to do this in NetBeans, or do I have to file a bug report?
There is a different (and better) solution compared to my other answer, based on feedback from the OP: download and install the the Editor Whitespace plugin.
Its download page shows that it has not been tested for any version of NetBeans more recent than 8.0, but I have checked that it still works with NetBeans 8.2 and NetBeans 11.2.
To use the plugin:
Click the Download button on the plugin page to install the plugin in some arbitrary location.
In NetBeans: Tools > Plugins > select the Downloaded tab
Click the Add Plugins... button, navigate to the downloaded plugin, click Open, then click Install.
There is no need to restart NetBeans after installing the plugin. Just check the menu option View > Show Non-printable characters to immediately see non-printable characters in source code, excluding line break (¶) characters.
By default the non-printable characters are shown as black dots, but you can use any other color instead:
Tools > Options > Fonts & Colors > Syntax
Select All Languages from the Language drop list, and Whitespace from the Category list. You can select a specific language form the drop list if you prefer.
Using the Foreground drop list, pick the color you want to use to show the dots representing non-printable spaces.
Select Custom... to create your own color if you don't like any of the standard options.
The only benefit to using the plugin is that it suppresses the display of line break (newline) characters, but that is definitely worthwhile. If you have a specific requirement to be able to see line break characters, don't install this plugin, and just use standard NetBeans functionality as described here.
You can change the font color of whitespace characters to any color you want, either for a specific language, or for all languages. Here's how to do it for Java on NetBeans 9:
Tools > Options > Fonts & Colors > Syntax
Select Java from the Language drop list, and Whitespace from the Category list.
Using the Foreground drop list, pick the color you want to use to show the dots representing non-printable spaces. Select Custom... to create your own color if you don't like any of the standard options. As you scroll through the options for Foreground the color of the dots representing printable spaces in the Preview screen change.
Here's a shot showing the color being changed to magenta:
Notes:
The approach described above does not change the color of the line break character at the end of each line, and I don't think that is possible. That is arguably a bug, and at least a missing feature.
Although you can change the Foreground color at any time, it is only relevant when View -> Show Non-printable Characters is checked. Checking that option is also necessary to see the whitespace characters in the Preview screen.
The Background color for Whitespace can also be modified, but the result is invariably ugly and unhelpful.

Convert tabs into spaces

Many editors and IDEs support converting spaces into tabs by using Tab/Shift+Tab on a line or a selected text fragment, but I've not found such a feature in Eclipse. Is there a plugin or something to add such functionality? I've tried to find one myself, but it doesn't seem to have any by keywords like "tab" or "indent". I'm working with Perl, BTW.
Check if the context menu has an entry like Source->Correct Indentation. That is available for Java, but the availability depends on the language you edit.
Otherwise you can install the AnyEdit Tools plugin which provides a command to convert the selection from tabs to spaces and vice versa.
If you change settings to tabs only or spaces only, Tab, Shift + Tab works as expected. (At least for me).

all spaces replaced by tabs when ctrl+shift+f

working in eclipse,when I type 'tab',it insert 4 spaces,it works well.but after ctrl +shift +f to format,all the 4 space will been replaced by tabs.how to stop it?
Window->Preferences->Java->Code Style->Formatter: Edit Active profile->Indentation->Tab Policy: Select Spaces
You can't change the default profiles so you must provide a new profile name, then press the Apply button, then the Okay button. It may help to press the Apply button once you have returned to the Formatter screen. Go back and look at the Tab Policy again to verify that your changes were saved.
Including the above suggestions, I recommend searching for code style or style to get to the coding standard being applied with the user requests formatting of the code. It is possible that the code style uses tabs instead of spaces.
The only way that currently works is to use Ctrl-A Ctrl-X Ctrl-V on all code after using Ctrl-Shift-F. This will replace all tabs with spaces.
Don't know which version of Eclipse you are using but for
Eclipse 3.6 (for example) you may go to
Window->Preferences->General->Editors->Text Editors->Insert spaces for tabs
This will change Eclipse to use spaces instead of tabs
The place in the Preferences may be different depending on which version of Eclipse you use. If you load the preferences window you can use the search function there to find "Formatters" and set your preferences for different types of files, or generally.

How do I type a literal tab character in Eclipse?

I feel very silly asking this question, but here goes. :)
I've configured Eclipse to insert spaces instead of tabs, but I'm working on a Makefile, which requires literal tab characters (see Can you make valid Makefiles without tab characters? for a good explanation).
So how do I type one, short of opening the Text Editors preferences, unticking the "Insert spaces for tabs" option, clicking Apply, and then undoing all of that when I'm done editing the makefile?
Only way I can find to do it in Eclipse (version=Juno) was to type say XXX where I wanted the tab character and then do a find/replace. Switch on regexp matching in the find and put XXX as find with \t as the replace. Painful but works.
If you're using the Eclipse's built-in Makefile editor (included in the C++ package I believe), tabs should be literal.
Sorry, I don't appear to have enough points to comment on the accepted answer, but I wanted to add that although the Makefile editor allows tabs to be entered, it doesn't use tabs when indenting multiple lines with the tab key, or if you enter a tab in block selection mode. This made me think I couldn't enter tabs for a while (I should probably raise a defect report).

How to show/reveal hidden or invisible characters in NetBeans?

How can you show/reveal hidden characters in NetBeans? In other editors, if this feature is turned on, a space might be shown as a small centered dot, and a tab as a right arrow. (This feature is useful to see if a file uses tabs or spaces for indentation, among other things.)
This feature was missing for a long time—a feature request was created on November 1999 and it was finally implemented on August 2010 (NetBeans 6.10). You can enable/disable it at "View → Show Non-printable Characters".
Bug history
As of NetBeans 7.0.1, the definition for "non-printable" seems to include tabs and carriage returns but not regular white space char:
NetBeans 7.1.0 finally displays spaces. However, now it has a new bug where consecutive tabs (or tabs & spaces combinations) collapse into one tab:
NetBeans 7.4.0 fixes this:
There're yet a couple of issues:
The end of file is represented with the same symbol as line feeds, thus making it non-obvious to determine whether the file ends with EOL.
Hidden chars are displayed in the same colour as regular text.
These issues have not been addressed so far but they can be sort of mitigated with the Editor Whitespace third-party plugin, which:
Hides the EOL and EOF markers (which aren't useful anyway).
Displays other whitespace characters using always the same colour.
in netbeans 7 you can enable display of spaces, tabs & line feeds like this:
spaces
download font from: http://netbeans.org/bugzilla/attachment.cgi?id=97902
install the ttf font
tools > options > font & colors > Syntax > All Languages > Whitespaces
choose the installed whitespace font
more info about the netbeans 6 bug: http://netbeans.org/bugzilla/show_bug.cgi?id=4619
tabs & line feeds
in netbeans 7 you can enable to see non-printable characters:
view > show non-printable characters
in netbeans 6 only the spaces part works
Using Netbeans 8.0.1
View-> Show Non-Printable characters
Ubuntu 11.10 => Netbeans 7.0.1
The "View → Show Non-printable Characters" mode really not shows whitespaces while font was not installed by me.
Thanks!
View -> Show Non-Printable characters
Using Netbeans 7.3.1,
View -> Show Non-Printable characters
I can see white-spaces, tabs, and carriage returns.
This feature has finally been added and is available in NetBeans 6.10. Since this has not been released yet, you can try out 6.10 MileStone 1: http://bits.netbeans.org/netbeans/6.10/m1/. I look forward to the final release!