* jode/swingui/Main.java.in (AreaWriter): Convert all kinds of

line breaks (CR+LF, CR, LF) to a LF character, which a JTextArea
understands.


git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1308 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
hoenicke 24 years ago
parent c5fae0c7ee
commit 5e972183a9
  1. 6
      jode/ChangeLog
  2. 19
      jode/jode/swingui/Main.java.in

@ -1,3 +1,9 @@
2001-02-27 Jochen Hoenicke <jochen@gnu.org>
* jode/swingui/Main.java.in (AreaWriter): Convert all kinds of
line breaks (CR+LF, CR, LF) to a LF character, which a JTextArea
understands.
2001-02-08 Jochen Hoenicke <jochen@gnu.org> 2001-02-08 Jochen Hoenicke <jochen@gnu.org>
* jode/expr/StoreInstruction.java (dumpExpression): Java doesn't * jode/expr/StoreInstruction.java (dumpExpression): Java doesn't

@ -143,6 +143,7 @@ public class Main
public class AreaWriter extends Writer { public class AreaWriter extends Writer {
boolean initialized = false; boolean initialized = false;
boolean lastCR = false;
private JTextArea area; private JTextArea area;
public AreaWriter(JTextArea a) { public AreaWriter(JTextArea a) {
@ -155,7 +156,23 @@ public class Main
area.setText(""); area.setText("");
initialized = true; initialized = true;
} }
area.append(new String(b, off, len)); String str = new String(b, off, len);
StringBuffer sb = new StringBuffer(len);
while (str != null && str.length() > 0) {
if (lastCR && str.charAt(0) == '\n')
str = str.substring(1);
int crIndex = str.indexOf('\r');
if (crIndex >= 0) {
sb.append(str.substring(0, crIndex));
sb.append("\n");
str = str.substring(crIndex+1);
lastCR = true;
} else {
sb.append(str);
str = null;
}
}
area.append(sb.toString());
} }
public void flush() { public void flush() {

Loading…
Cancel
Save