在Eclipse中复制和粘贴会在每个粘贴行的末尾添加窗口换行符 [英] Copy and paste in Eclipse adds window newlines at the end of each pasted line

查看:507
本文介绍了在Eclipse中复制和粘贴会在每个粘贴行的末尾添加窗口换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS X(10.7)上使用Eclipse(版本:Indigo Service Release 2)与PHP开发工具和Aptana Studio 3插件。

I am using Eclipse (Version: Indigo Service Release 2) on Mac OS X (10.7) with PHP Development Tools and Aptana Studio 3 Plugin.

在首选项>一般>工作区我选择了:
- 文本文件编码= UTF-8
- 新的文本文件行delimiter = Unix
在首选项>常规>编辑器>文本编辑器我启用了显示空格字符。

In Preferences > General > Workspace I have selected: - Text file encoding = UTF-8 - New text file line delimiter = Unix In Preferences > General > Editors > Text Editors I have enabled "Show whitespace characters".

我还使用文件>转换行分隔符到> Unix定期更改任何窗口换行符。

I also use "File > Convert Line Delimiters To > Unix" to regularly change any windows newlines.

文本的复制粘贴会在粘贴文本的整行末尾添加窗口换行符(^ M)。尽管复制的文本是Windows的新行字符的干净,但这种情况仍然发生。如果所有复制粘贴的文本(从相同的文件/编辑器或其他来源)至少包含一行,则会发生这种情况。我注意到git提交的行为。

Copy-paste of text adds windows newlines (^M) characters at the end of whole lines in the pasted text. This happens despite the fact that the text copied is "clean" of Windows new line characters. This happens for all copy-pasted text (from the same file/editor, or from other sources) if it has at least one whole line in it. I noticed the behavior in git commits.

我相信我已经用尽了所有可能的解释,在我的研究中没有找到任何东西。

I believe I have exhausted all possible explanations and did not find anything in my research.

我怀疑Aptana插件是一个问题,因为我有一个第二个(单独的)安装的Eclipse,所有设置如上减去Aptana插件,从来没有经历过类似的事情。然而,我无法在Aptana首选项中找到任何可能的解决方案。

I suspect the Aptana Plugin is the problem because I have a second (separate) installation of Eclipse with all set as above minus the Aptana plugin and never experienced something similar. Nevertheless I can not find anything in Aptana preferences that would look like a potential solution.

在我称这个bug之前的任何想法?

Any ideas before I call this a bug?

推荐答案

我有同样令人讨厌的问题。经过一些研究和实验,我想我发现了错误的根源和解决方法。

I had exactly the same annoying problem. After some research and experimentation I think I found the source of the bug and a workaround.

我的设置观察(Eclipse 3.7.2,PDT 3.0.0,no aptana):

Observations on my set up (Eclipse 3.7.2, PDT 3.0.0, no aptana):


  • 只在我在PHP $文件里面<?php?> 分隔符。

  • 只有当游标位于只有空白行的某处时,粘贴才会粘贴。粘贴后,所有的空白都被删除。

  • 当行上有一个非空格字符时,它不会发生。当粘贴在非空白字符前面时,字符前面的空格被删除。

  • it only occurred for me in PHP files inside the <?php ?> delimiters.
  • it only occurred when pasting while the cursor is somewhere on a line with only whitespace. After pasting, all whitespace was removed.
  • When there was a non whitespace character on the line, it did not occur. When pasting in front of the non-whitespace character, the whitespace in front of the character was however removed.

这种行为感觉像问题与自动缩进处理,所以我尝试删除/启用缩进相关的选项。
禁用以下选项为我修复:

This behavior felt like an issue with automatic indentation handling, so I tried dis-/enabling indentation related options. Disabling the following option fixed it for me:

PHP>编辑器>打字>粘贴时调整缩进

PHP > Editor > Typing > When pasting adjust indentation

祝你好运

这篇关于在Eclipse中复制和粘贴会在每个粘贴行的末尾添加窗口换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆