JSyntaxHighlighter/LineNumbers.java
protected void doSelection() {
		        int first = min(anchor, lastIndex);
		        int last = max(anchor, lastIndex);
		
		        try {
		              String text = editorPane.getDocument().getText(0, editorPane.getDocument().getLength());
		              int index = -1, lines = 1;
		
		              while (lines < first) {
		                    index = text.indexOf('\n', index + 1);
		            lines++;
		      }
		      int firstindex = index + 1;
		
		      do {
		            index = text.indexOf('\n', index + 1);
		                    lines++;
		              } while (lines <= last && index > 0);
		              int lastindex;
		
		              if (index < 0) {
		                    lastindex = editorPane.getDocument().getLength();
		              } else {
		                    lastindex = index + 1;
		              }
		              editorPane.setSelectionStart(firstindex);
		              editorPane.setSelectionEnd(lastindex);
		        } catch (BadLocationException ignored) {}
		  }
/**
		   * Handles selection in the text pane due to gestures on the line numbers.
		   */
Handles selection in the text pane due to gestures on the line numbers.
Handles selection in the text pane due to gestures on the line numbers .
protected void doSelection() {
		        int first = min(anchor, lastIndex);
		        int last = max(anchor, lastIndex);
		        try {
		              String text = editorPane.getDocument().getText(0, editorPane.getDocument().getLength());
		              int index = -1, lines = 1;
		              while (lines < first) {
		                    index = text.indexOf('\n', index + 1);
		            lines++;
		      }
		      int firstindex = index + 1;
		      do {
		            index = text.indexOf('\n', index + 1);
		                    lines++;
		              } while (lines <= last && index > 0);
		              int lastindex;
		              if (index < 0) {
		                    lastindex = editorPane.getDocument().getLength();
		              } else {
		                    lastindex = index + 1;
		              }
		              editorPane.setSelectionStart(firstindex);
		              editorPane.setSelectionEnd(lastindex);
		        } catch (BadLocationException ignored) {}
		  }
protected void doSelection ( ) { int first = min ( anchor , lastIndex ) ; int last = max ( anchor , lastIndex ) ; try { String text = editorPane . getDocument ( ) . getText ( 0 , editorPane . getDocument ( ) . getLength ( ) ) ; int index = - 1 , lines = 1 ; while ( lines < first ) { index = text . indexOf ( '\n' , index + 1 ) ; lines ++ ; } int firstindex = index + 1 ; do { index = text . indexOf ( '\n' , index + 1 ) ; lines ++ ; } while ( lines <= last && index > 0 ) ; int lastindex ; if ( index < 0 ) { lastindex = editorPane . getDocument ( ) . getLength ( ) ; } else { lastindex = index + 1 ; } editorPane . setSelectionStart ( firstindex ) ; editorPane . setSelectionEnd ( lastindex ) ; } catch ( BadLocationException ignored ) { } }
Handles selection in the text pane due to gestures on the line numbers.
Handles selection in the text pane due to gestures on the line numbers .