Eclipse:我打开了隐藏字符,现在无法关闭

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2330620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:13:20  来源:igfitidea点击:

Eclipse: I turned on hidden characters now I can't turn off

eclipse

提问by Brett

Somehow I've turned on hidden characters in Eclipse. It's not the "whitespace" characters in the general editor preferences. When turned on, it adds another layer of hidden characters over the existing ones.

不知何故,我在 Eclipse 中打开了隐藏字符。它不是一般编辑器首选项中的“空白”字符。打开后,它会在现有字符上添加另一层隐藏字符。

Then I have things like

然后我有这样的事情

\r\n

\r\n

Does anyone know what these are and how to remove them?

有谁知道这些是什么以及如何删除它们?

回答by Sandkastenliga

It is under Preferences > General > Editors > Text Editors. There is a checkbox labeled "Show whitespace characters". If you uncheck this the editor switches back to normal.

它位于首选项 > 常规 > 编辑器 > 文本编辑器下。有一个标记为“显示空白字符”的复选框。如果取消选中此项,编辑器将恢复正常。

If you click on the "whitespace characters" link in this line you will get a popup window, in which you can define which characters eclipse is supposed to consider as whitespace characters.

如果单击此行中的“空白字符”链接,您将看到一个弹出窗口,您可以在其中定义 eclipse 应该将哪些字符视为空白字符。

In this popup window you also get the option to define the transparency in which each whitespace character is displayed in the editor, which you can use to (indirectly) change their foreground colour. I'm just mentioning it here, because it took me about half an hour to find this setting! ;-)

在此弹出窗口中,您还可以选择定义每个空白字符在编辑器中显示的透明度,您可以使用它来(间接)更改其前景色。我只是在这里提到它,因为我花了大约半个小时才找到这个设置!;-)

回答by Rajesh Goel

There is a toggle button 'Show Whitespace Chars' on the Eclipse toolbar

Eclipse 工具栏上有一个切换按钮“显示空白字符”

screenshot of toolbar showing the Show Whitespace Characters button

显示“显示空白字符”按钮的工具栏屏幕截图

回答by iTake

A great tip about using 'quick access' from eclipse forum:

关于从eclipse 论坛使用“快速访问”的一个很好的提示:

CTRL+3 swc

Allows to turn them on and off

允许打开和关闭它们

回答by davioooh

The right shortcut is Ctrl+ N

正确的快捷键是Ctrl+N

UPDATEFrom Eclipse 3.7 version, something is changed... Now you have to go to:

更新从 Eclipse 3.7 版本开始,有些事情发生了变化......现在你必须去:

Window > Preferences > General > Editors > Text Editors

窗口 > 首选项 > 常规 > 编辑器 > 文本编辑器

回答by Mark Mandel

CTRL+ .does the job.

CTRL+.完成工作。

回答by Boaz - Reinstate Monica

For Aptana Users

对于 Aptana 用户

To toggle hidden characters in Aptana on and off, use the following keyboard shortcut:

Ctrl+Alt+W

要打开和关闭 Aptana 中的隐藏字符,请使用以下键盘快捷键:

Ctrl+ Alt+W

回答by shougun

It is actually in two places...

其实有两个地方...

Sandkastenliga points out the obvious one, but you can also show white space with a shortcut key combination. The key combination is separate from the text editor preferences and will superimpose additional characters when active (it uses \r and \n for carriage return an line feed respectively instead of the symbols used by the text editor preference.)

Sandkastenliga 指出了一个显而易见的问题,但您也可以使用快捷键组合来显示空白。组合键与文本编辑器首选项分开,并在活动时叠加其他字符(它使用 \r 和 \n 分别回车换行,而不是文本编辑器首选项使用的符号。)

Go to preferences > general > keys and look for the binding for the 'Show Whitespace' command.

转到首选项> 常规> 键并查找“显示空白”命令的绑定。

I have the text editor preference turned on, so I removed the binding for this command altogether (it was set to Ctrl+. in my profile) to prevent accidental activation as it doesn't affect the other preference.

我打开了文本编辑器首选项,因此我完全删除了此命令的绑定(在我的配置文件中设置为 Ctrl+.)以防止意外激活,因为它不会影响其他首选项。

回答by Saikat

I am using Eclipse Oxygen and can see this option to toggle whitespace characters:

我正在使用 Eclipse Oxygen,可以看到这个选项来切换空白字符:

enter image description here

enter image description here

回答by TheKahuna

Go to Window > Preferences > General > Editors > Text Editors

转到窗口 > 首选项 > 常规 > 编辑器 > 文本编辑器

Uncheck the "Show whitespace characters" option on the right side of the page, then click "Apply" at the bottom of the page.

取消选中页面右侧的“显示空白字符”选项,然后单击页面底部的“应用”。

回答by kev

You can add "Show Whitespace Characters" button in toolbar by customizing your perspective. It also contains buttons to toggle word wrap, and toggle selection mode.

您可以通过自定义视角在工具栏中添加“显示空白字符”按钮。它还包含用于切换自动换行和切换选择模式的按钮。

enter image description here

enter image description here

Go to Window > Perspective > Customize Perspective > Action Set Availability, then select "Editor Presentation" action set:eclipse

转到“窗口”>“透视”>“自定义透视”>“操作集可用性”,然后选择“编辑器演示”操作集:eclipse

This works in Eclipse Neon.

这适用于 Eclipse Neon。

You can also add a key binding for this action. Go to Preferences > General > Keys > "Show Whitespace Characters"

您还可以为此操作添加键绑定。转到首选项 > 常规 > 键 > “显示空白字符”