• R/O
  • SSH
  • HTTPS

smart-gs: コミット


コミットメタ情報

リビジョン1201 (tree)
日時2016-10-31 12:54:41
作者ohura

ログメッセージ

[editor-simplyhtml-merge] Editorを開いた時、不要な空白が入る問題を修正
これで、Global Text Searchの結果からEditorを開いた時ずれなくなる。

変更サマリ

差分

--- branches/editor-simplyhtml-merge/src/smart_gs/simplyhtml/SGSDocumentPane.java (revision 1200)
+++ branches/editor-simplyhtml-merge/src/smart_gs/simplyhtml/SGSDocumentPane.java (revision 1201)
@@ -24,6 +24,7 @@
2424 import smart_gs.logical.SmartDocument;
2525 import smart_gs.simplyhtml.SGSDocument.SGSGTtag;
2626 import smart_gs.text_highlight.TextHighlight;
27+import smart_gs.util.XMLUtils;
2728 import sml_editor.swingui.EditorMouseListener;
2829
2930 public class SGSDocumentPane extends DocumentPane implements ChangeListener, DocumentListener {
@@ -99,7 +100,12 @@
99100 SGSHTMLEditorKit kit = (SGSHTMLEditorKit) editorPane.getEditorKit();
100101 SGSHTMLDocument doc = (SGSHTMLDocument) kit.createDefaultDocument();
101102
103+ if(source.indexOf("<body>") ==-1){
104+ source = "<body>" + source + "</body>";
105+ }
102106 String body = source.substring(source.indexOf("<body>"), source.indexOf("</body>")+"</body>".length());
107+ body = body.replaceAll("&#160;", " ");
108+ body = XMLUtils.unindent(body);
103109 StringReader in = new StringReader(body);
104110 try {
105111 kit.read(in, doc, 0);
--- branches/editor-simplyhtml-merge/src/smart_gs/simplyhtml/SGSHTMLEditor.java (revision 1200)
+++ branches/editor-simplyhtml-merge/src/smart_gs/simplyhtml/SGSHTMLEditor.java (revision 1201)
@@ -21,6 +21,7 @@
2121
2222 import smart_gs.logical.SmartDocument;
2323 import smart_gs.simplyhtml.SGSDocument.SGSLineTag;
24+import smart_gs.util.XMLUtils;
2425
2526
2627 public class SGSHTMLEditor extends SHTMLPanelSingleDocImpl{
@@ -169,11 +170,12 @@
169170 }
170171 String bodyText;
171172 bodyText = docTextCase.substring(tagStartClose, tagEndOpen);
173+ bodyText = bodyText.replaceAll("&#160;", " ");
174+ bodyText = XMLUtils.unindent(bodyText);
172175 bodyText = bodyText.trim();
173176 bodyText = bodyText.replaceAll("\r", "");
174177 bodyText = bodyText.replaceAll("\n", "");
175178 bodyText = bodyText.replaceAll("\r\n", "");
176- bodyText = bodyText.replaceAll("&#160;", " ");
177179 bodyText = UnicodeDecode.decode(bodyText);
178180 return bodyText;
179181 }
旧リポジトリブラウザで表示