ide/src/wombat/gui/text/REPLTextArea.java
protected void checkRun() {
		// The cursor should be on the last line and there should be at least some text. 
		if (!getText().trim().isEmpty() && getText().substring(code.getCaretPosition()).trim().isEmpty()) {
			
			// Check to see that we have a matched pair of brackets.
	        Stack<Character> brackets = new Stack<Character>();
	        char[] cs = getText().toCharArray();
	        char c;
	        for (int i = 0; i < cs.length; i++) {
	        	c = cs[i];
	        	
	        	// Skip character literals
	        	if (c == '#' && cs[i + 1] == '\\') {
	        		i += 2;
	        		continue;
	        	}
	        	
	        	// Skip strings
	        	if (c == '"') {
	        		int end = getText().indexOf('"', i + 1);
	        		i += (end - i);
	        	}
	        	
	            if (c == '(') brackets.push(')');
	            else if (c == '[') brackets.push(']');
	            else if (c == ')' || c == ']')
	                if (!brackets.empty() && brackets.peek() == c)
	                    brackets.pop();
	                else
	                    return;
	        }
	
	        // This means we matched them all.
	        if (brackets.empty()) {
	        	commandHistory.add(getText());
	        	currentCommand = commandHistory.size();
	        	
	            MainFrame.Singleton().doCommand(getText());
	            setText("");
	            return;
	        }
		}
        
        // Either we didn't match the brackets or we aren't on the last line. Insert the return normally.
        try {
            code.getDocument().insertString(code.getCaretPosition(), SchemeTextArea.NL, null);
        } catch (BadLocationException ble) {
            System.err.println("badwolf");
        }
        tab();
	}
/**
	 * Check if the command should run, run it if it should.
	 * 
	 * To run:
	 * - Last line
	 * - Brackets are matched
	 */
Check if the command should run, run it if it should.

To run:
- Last line
- Brackets are matched
Check if the command should run run it if it should . To run : - Last line - Brackets are matched
protected void checkRun() {
		if (!getText().trim().isEmpty() && getText().substring(code.getCaretPosition()).trim().isEmpty()) {
	        Stack<Character> brackets = new Stack<Character>();
	        char[] cs = getText().toCharArray();
	        char c;
	        for (int i = 0; i < cs.length; i++) {
	        	c = cs[i];
	        	if (c == '#' && cs[i + 1] == '\\') {
	        		i += 2;
	        		continue;
	        	}
	        	if (c == '"') {
	        		int end = getText().indexOf('"', i + 1);
	        		i += (end - i);
	        	}
	            if (c == '(') brackets.push(')');
	            else if (c == '[') brackets.push(']');
	            else if (c == ')' || c == ']')
	                if (!brackets.empty() && brackets.peek() == c)
	                    brackets.pop();
	                else
	                    return;
	        }
	        if (brackets.empty()) {
	        	commandHistory.add(getText());
	        	currentCommand = commandHistory.size();
	            MainFrame.Singleton().doCommand(getText());
	            setText("");
	            return;
	        }
		}
        try {
            code.getDocument().insertString(code.getCaretPosition(), SchemeTextArea.NL, null);
        } catch (BadLocationException ble) {
            System.err.println("badwolf");
        }
        tab();
	}
protected void checkRun ( ) { if ( ! getText ( ) . trim ( ) . isEmpty ( ) && getText ( ) . substring ( code . getCaretPosition ( ) ) . trim ( ) . isEmpty ( ) ) { Stack < Character > brackets = new Stack < Character > ( ) ; char [ ] cs = getText ( ) . toCharArray ( ) ; char c ; for ( int i = 0 ; i < cs . length ; i ++ ) { c = cs [ i ] ; if ( c == '#' && cs [ i + 1 ] == '\\' ) { i += 2 ; continue ; } if ( c == '"' ) { int end = getText ( ) . indexOf ( '"' , i + 1 ) ; i += ( end - i ) ; } if ( c == '(' ) brackets . push ( ')' ) ; else if ( c == '[' ) brackets . push ( ']' ) ; else if ( c == ')' || c == ']' ) if ( ! brackets . empty ( ) && brackets . peek ( ) == c ) brackets . pop ( ) ; else return ; } if ( brackets . empty ( ) ) { commandHistory . add ( getText ( ) ) ; currentCommand = commandHistory . size ( ) ; MainFrame . Singleton ( ) . doCommand ( getText ( ) ) ; setText ( "" ) ; return ; } } try { code . getDocument ( ) . insertString ( code . getCaretPosition ( ) , SchemeTextArea . NL , null ) ; } catch ( BadLocationException ble ) { System . err . println ( "badwolf" ) ; } tab ( ) ; }
Check if the command should run, run it if it should.
Check if the command should run run it if it should .
// The cursor should be on the last line and there should be at least some text.  // Check to see that we have a matched pair of brackets. // Skip character literals // Skip strings // This means we matched them all. // Either we didn't match the brackets or we aren't on the last line. Insert the return normally.