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

查看:49
本文介绍了在 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- 新的文本文件行分隔符 = 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"来定期更改任何 Windows 换行符.

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

文本的复制粘贴在粘贴文本的整行末尾添加 windows 换行符 (^M) 字符.尽管复制的文本干净"了 Windows 换行符,但仍会发生这种情况.如果所有复制粘贴的文本(来自同一文件/编辑器,或来自其他来源)中至少有一整行,则会发生这种情况.我注意到 git commits 中的行为.

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.

在我称之为错误之前有什么想法吗?

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,没有 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天全站免登陆