移动和消失的代码行;Eclipse 的 XML 编辑器的问题 [英] Moving and vanishing lines of code; trouble with Eclipse's XML Editor

查看:31
本文介绍了移动和消失的代码行;Eclipse 的 XML 编辑器的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我的代码会自行移动或在 Eclipse XML 编辑器中消失.

Sometimes my code moves on its own or just disappears in the Eclipse XML editor.

当我突出显示受影响的代码时,突出显示的行会尝试自行更正.但是当我向相反方向滚动或拖动鼠标时,代码再次移动.从本质上讲,我将从其他无错误文件中显示重复、丢失、 断行的代码.受影响的文件do 编译,如果我关闭/重新打开它们,这个问题就暂时消失了.对正在发生的事情有什么想法吗?

When I highlight the affected code, the highlighted lines try to correct themselves. But when I scroll or drag the mouse in the opposite direction the code shifts again. In essence I will have repeating, missing, and broken lines of code being displayed from an otherwise error free file. The files affected do compile and if I close / re-open them this problem goes away, for the moment. Any ideas on what's happening?

添加:Jeff Axelrod 提供了一个链接到一个新的 错误报告 与 Google.

Addition: Jeff Axelrod provided a link to a new bug report with Google.

推荐答案

此错误已(最终)在 ADT 21 中修复.该修复程序现已在几分钟前发布的 ADT 21 预览版 9 中提供,此处:https://android-review.googlesource.com/#/c/44936/1

This bug is (finally) fixed in ADT 21. The fix is now available in ADT 21 Preview 9, posted a few minutes ago, here: https://android-review.googlesource.com/#/c/44936/1

您得到奇怪的视觉效果的原因是,如果文件包含损坏的 DOS 行结尾(多个回车,每个回车没有换行符),Eclipse 会非常困惑.那是 Eclipse 问题 https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421

The reason you get weird visual artifacts is that if a file contains broken DOS line endings (multiple carriage returns without a newline for each carriage return), Eclipse gets very confused. That's Eclipse issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421 .

修复分为两部分:(1) 首先,ADT 已修复,不再将这些 序列引入文档.这可以确保您不会获得触发奇怪编辑行为的新文档,但它不会追溯修复具有这些行结尾的旧文档,因此如果您打开它们,您仍然会遇到奇怪的编辑行为.

There are two parts to the fix: (1) First, ADT was fixed such that it no longer introduces these sequences into the document. This makes sure that you don't get new documents which triggers the weird editing behavior, but it does not retroactively fix older documents with these line endings, so if you open them, you still get weird editing behavior.

(2) 其次,有一个新的 lint 检查,用于查找文档中的断行结尾.这会以增量方式运行,因此如果您编辑存在此问题的 XML 文件,ADT 将为此问题添加一个错误标记 -- 以及对文档进行修复以修复它的快速修复.

(2) Second, there's a new lint check which looks for broken line endings in documents. This runs incrementally, so if you edit an XML file which has this problem, ADT will add an error marker for this problem -- along with a quickfix to perform surgery on the document to fix it.

简而言之:获取 ADT 21 预览版 9;在您的项目上运行 Lint 并查找有关包含断行结尾的文件的任何投诉,如果找到任何投诉,请应用 quickfix.从现在开始,使用布局编辑器进一步编辑应该保持文件格式一致.

In short: Get ADT 21 Preview 9; run Lint on your projects and look for any complaints about files containing broken line endings, and if it finds any, apply the quickfix. From now on, further edits with the layout editor should keep the files consistently formatted.

仅供参考,相关修复在这里:https://android-review.googlesource.com/#/c/44936/

FYI, the relevant fix is here: https://android-review.googlesource.com/#/c/44936/

有关轻松更新 SDK 工具和 Eclipse ADT 插件的说明如下:http://tools.android.com/preview-channel

Instructions for easily updating SDK Tools and the Eclipse ADT plugin are here: http://tools.android.com/preview-channel

-- Tor(来自 Android 工具团队)

-- Tor (from the Android tools team)

这篇关于移动和消失的代码行;Eclipse 的 XML 编辑器的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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