Eclipse編輯頁面空格佔位異常的問題

來源:互聯網
上載者:User

標籤:風格   target   style   title   blank   

  最近的項目,被同事吐槽代碼風格太隨意,都沒有對齊。

  我理直氣壯的在eclipse中開啟了他們的代碼,顯示如下:

650) this.width=650;" title="image" style="border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px;" border="0" alt="image" src="http://img1.51cto.com/attachment/201409/24/4828774_1411549123Aeq3.png" width="244" height="156" />

 

此時同事默默的用UE開啟了代碼,顯示如下:

650) this.width=650;" title="image" style="border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px;" border="0" alt="image" src="http://img1.51cto.com/attachment/201409/24/4828774_14115491238Fjz.png" width="244" height="87" />

 

同一份代碼,在不同的編輯器中,顯示差異如此之大。

再用notepad++開啟,同UE顯示一致。

 

顯然問題出在eclipse的顯示上。

 

在網上搜了一圈,沒有相關的問題。

再仔細的對比了兩種顯示,發現eclipse中空格的顯示寬度比一般的字元略小,造成了多個空格連在一起時,對齊方面就有了問題。

經過幾個小時的反覆尋找,總算髮現了問題所在。

 

在eclipse中,我是用了華文宋體的字型,這種字型的空格都比其他字元略小,在對齊上會有問題。

雖然,華文**的字型都要比其他字型來的好看,但為了代碼的整潔性,我只得忍痛捨棄了它。

選擇幼圓字型後,eclipse的顯示如下:

650) this.width=650;" title="image" style="border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px;" border="0" alt="image" src="http://img1.51cto.com/attachment/201409/24/4828774_1411549124Kp8x.png" width="244" height="94" />

 

總算顯示正常了。

 

特此記錄這個問題,以備後查。

本文出自 “學無止境” 部落格,請務必保留此出處http://anfernee.blog.51cto.com/4828774/1557830

Eclipse編輯頁面空格佔位異常的問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.