3131/**
3232 * The text area component from the JEdit Syntax (syntax.jedit.org) project.
3333 * This is a very early version of what later was completely rewritten and
34- * become jEdit (jedit.org). Over the years we've also added minor features
34+ * become jEdit (jedit.org). Over the years we've also added minor features
3535 * for use with Processing (notably mouse wheel support and copyAsHTML). [fry]
3636 * <p>
3737 * jEdit's text area component. It is more suited for editing program
@@ -70,7 +70,7 @@ public class JEditTextArea extends JComponent
7070 * bar is added this way.
7171 */
7272 public static String LEFT_OF_SCROLLBAR = "los" ;
73-
73+
7474 /** The size of the offset between the leftmost padding and the code */
7575 public static final int leftHandGutter = 6 ;
7676
@@ -87,13 +87,13 @@ public JEditTextArea(TextAreaDefaults defaults) {
8787 caretTimer = new Timer (500 , new ActionListener () {
8888 public void actionPerformed (ActionEvent e ) {
8989 if (hasFocus ()) {
90- blinkCaret ();
90+ blinkCaret ();
9191 }
9292 }
9393 }); //new CaretBlinker//new CaretBlinker());
9494 caretTimer .setInitialDelay (500 );
9595 caretTimer .start ();
96-
96+
9797 // Initialize some misc. stuff
9898 painter = new TextAreaPainter (this , defaults );
9999 documentHandler = new DocumentHandler ();
@@ -641,7 +641,7 @@ public int xToOffset(int line, int x) {
641641
642642 } else {
643643 Token tokens ;
644- if (painter .currentLineIndex == line &&
644+ if (painter .currentLineIndex == line &&
645645 painter .currentLineTokens != null ) {
646646 tokens = painter .currentLineTokens ;
647647 } else {
@@ -668,7 +668,7 @@ public int xToOffset(int line, int x) {
668668
669669 for (int i = 0 ; i < length ; i ++) {
670670// System.out.println("segmentOffset = " + segmentOffset +
671- // ", offset = " + offset +
671+ // ", offset = " + offset +
672672// ", i = " + i +
673673// ", length = " + length +
674674// ", array len = " + segmentArray.length);
@@ -833,7 +833,7 @@ public int getLineStartNonWhiteSpaceOffset(int line)
833833 }
834834 return offset + length ;
835835 }
836-
836+
837837 /**
838838 * Returns the end offset of the specified line.
839839 * @param line The line
@@ -849,7 +849,7 @@ public int getLineStopOffset(int line)
849849 else
850850 return lineElement .getEndOffset ();
851851 }
852-
852+
853853 public int getLineStopNonWhiteSpaceOffset (int line )
854854 {
855855 int offset = getLineStopOffset (line );
@@ -861,12 +861,12 @@ public int getLineStopNonWhiteSpaceOffset(int line)
861861 return offset - i ;
862862 }
863863 }
864-
864+
865865 return offset - length ;
866866 }
867867
868868 /**
869- * Returns the start offset of the line after this line, or the end of
869+ * Returns the start offset of the line after this line, or the end of
870870 * this line if there is no next line.
871871 * @param line The line
872872 * @return The end offset of the specified line, or -1 if the line is
@@ -1249,13 +1249,13 @@ public void select(int start, int end)
12491249 // getLineOfOffset(end));
12501250 }
12511251 }
1252-
1252+
12531253 private enum CharacterKinds {
12541254 Word ,
12551255 Whitespace ,
12561256 Other
12571257 }
1258-
1258+
12591259 private CharacterKinds CharacterKind ( char ch , String noWordSep )
12601260 {
12611261 if ( Character .isLetterOrDigit (ch ) || ch =='_' || noWordSep .indexOf (ch ) != -1 )
@@ -1273,7 +1273,7 @@ protected void setNewSelectionWord( int line, int offset )
12731273 newSelectionEnd = newSelectionStart ;
12741274 return ;
12751275 }
1276-
1276+
12771277 String noWordSep = (String )document .getProperty ("noWordSep" );
12781278 if (noWordSep == null )
12791279 noWordSep = "" ;
@@ -1284,9 +1284,9 @@ protected void setNewSelectionWord( int line, int offset )
12841284 int wordEnd = lineText .length ();
12851285
12861286 char ch = lineText .charAt (Math .max (0 ,offset - 1 ));
1287-
1287+
12881288 CharacterKinds thisWord = CharacterKind (ch ,noWordSep );
1289-
1289+
12901290 for (int i = offset - 1 ; i >= 0 ; i --) {
12911291 ch = lineText .charAt (i );
12921292 if (CharacterKind (ch ,noWordSep ) != thisWord ) {
@@ -1303,7 +1303,7 @@ protected void setNewSelectionWord( int line, int offset )
13031303 }
13041304 }
13051305 int lineStart = getLineStartOffset (line );
1306-
1306+
13071307 newSelectionStart = lineStart + wordStart ;
13081308 newSelectionEnd = lineStart + wordEnd ;
13091309 }
@@ -1678,14 +1678,14 @@ public void copy() {
16781678 * rather than opening a new window.
16791679 * <p/>
16801680 * Updated for 0144 to only format the selected lines.
1681- * <p/>
1682- * Updated for 0185 to incorporate the HTML changes from the Arduino project,
1683- * and set the formatter to always use HTML (disabling, but not removing the
1681+ * <p/>
1682+ * Updated for 0185 to incorporate the HTML changes from the Arduino project,
1683+ * and set the formatter to always use HTML (disabling, but not removing the
16841684 * YaBB version of the code) and also fixing it for the Tools API.
16851685 * <p/>
1686- * Updated for 0190 to simply be part of JEditTextArea, removed YaBB code.
1686+ * Updated for 0190 to simply be part of JEditTextArea, removed YaBB code.
16871687 * Simplest and most sensible to have it live here, since it's no longer
1688- * specific to any language or version of the PDE.
1688+ * specific to any language or version of the PDE.
16891689 */
16901690 public void copyAsHTML () {
16911691 StringBuffer cf = new StringBuffer ("<pre>\n " );
@@ -1803,7 +1803,7 @@ private void emitAsHTML(StringBuffer cf, int line) {
18031803
18041804
18051805 /**
1806- * Handle encoding HTML entities for lt, gt, and anything non-ASCII.
1806+ * Handle encoding HTML entities for lt, gt, and anything non-ASCII.
18071807 */
18081808 private void appendAsHTML (StringBuffer buffer , char c ) {
18091809 if (c == '<' ) {
@@ -1826,11 +1826,11 @@ public void paste() {
18261826 if (editable ) {
18271827 Clipboard clipboard = getToolkit ().getSystemClipboard ();
18281828 try {
1829- String selection =
1829+ String selection =
18301830 ((String ) clipboard .getContents (this ).getTransferData (DataFlavor .stringFlavor ));
18311831
18321832 if (selection .contains ("\r \n " )) {
1833- selection = selection .replaceAll ("\r \n " , "\n " );
1833+ selection = selection .replaceAll ("\r \n " , "\n " );
18341834
18351835 } else if (selection .contains ("\r " )) {
18361836 // The Mac OS MRJ doesn't convert \r to \n, so do it here
@@ -1844,7 +1844,7 @@ public void paste() {
18441844 char [] c = new char [tabSize ];
18451845 Arrays .fill (c , ' ' );
18461846 String tabString = new String (c );
1847- selection = selection .replaceAll ("\t " , tabString );
1847+ selection = selection .replaceAll ("\t " , tabString );
18481848 }
18491849
18501850 // particularly on macosx when pasting from safari,
@@ -2332,7 +2332,7 @@ public void mouseDragged(MouseEvent evt)
23322332 public void mouseMoved (MouseEvent evt ) {}
23332333 }
23342334
2335-
2335+
23362336 class FocusHandler implements FocusListener
23372337 {
23382338 public void focusGained (FocusEvent evt )
@@ -2361,14 +2361,14 @@ public void mousePressed(MouseEvent evt)
23612361// setCaretVisible(true);
23622362// focusedComponent = JEditTextArea.this;
23632363 // Here be dragons: for release 0195, this fixes a problem where the
2364- // line segment data from the previous window was being used for
2364+ // line segment data from the previous window was being used for
23652365 // selections, causing an exception when the window you're clicking to
23662366 // was not full of text. Simply ignoring clicks when not focused fixes
23672367 // the problem, though it's not clear why the wrong Document data was
23682368 // being using regardless of the focusedComponent.
23692369// if (focusedComponent != JEditTextArea.this) return;
23702370 if (!hasFocus ()) {
2371- System .out .println ("requesting focus in window" );
2371+ // System.out.println("requesting focus in window");
23722372 requestFocusInWindow ();
23732373 return ;
23742374 }
0 commit comments