/[classpath]/classpath/javax/swing/text/PlainDocument.java
ViewVC logotype

Diff of /classpath/javax/swing/text/PlainDocument.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4.2.6 by gnu_andrew, Tue Aug 2 20:12:38 2005 UTC revision 1.4.2.7 by gnu_andrew, Wed Nov 2 00:44:03 2005 UTC
# Line 132  public class PlainDocument extends Abstr Line 132  public class PlainDocument extends Abstr
132          // collapse elements if the removal spans more than 1 line          // collapse elements if the removal spans more than 1 line
133          Element newEl = createLeafElement(rootElement,          Element newEl = createLeafElement(rootElement,
134                                            SimpleAttributeSet.EMPTY,                                            SimpleAttributeSet.EMPTY,
135                                            start, end - len);                                            start, end);
136          rootElement.replace(i1, i2 - i1, new Element[]{ newEl });          rootElement.replace(i1, i2 - i1 + 1, new Element[]{ newEl });
137        }        }
138    }    }
139    
# Line 147  public class PlainDocument extends Abstr Line 147  public class PlainDocument extends Abstr
147      Element root = getDefaultRootElement();      Element root = getDefaultRootElement();
148      return root.getElement(root.getElementIndex(pos));      return root.getElement(root.getElementIndex(pos));
149    }    }
150    
151      /**
152       * Inserts a string into the document. If the document property
153       * '<code>filterNewLines</code>' is set to <code>Boolean.TRUE</code>, then
154       * all newlines in the inserted string are replaced by space characters,
155       * otherwise the superclasses behaviour is executed.
156       *
157       * Inserting content causes a write lock to be acquired during this method
158       * call.
159       *
160       * @param offs the offset at which to insert the string
161       * @param str the string to be inserted
162       * @param atts the text attributes of the string to be inserted
163       *
164       * @throws BadLocationException
165       */
166      public void insertString(int offs, String str, AttributeSet atts)
167        throws BadLocationException
168      {
169        String string = str;
170        if (Boolean.TRUE.equals(getProperty("filterNewlines")))
171          string = str.replaceAll("\n", " ");
172        super.insertString(offs, string, atts);
173      }
174  }  }

Legend:
Removed from v.1.4.2.6  
changed lines
  Added in v.1.4.2.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26