*
authorindvdum
Wed, 18 May 2011 00:43:34 +0400
changeset 501a04ffaf85f
parent 4 27bd1032a5c6
child 6 8a7e51bd3ddb
*
src/main/java/org/vaadin/console/client/ui/TextConsole.java
     1.1 --- a/src/main/java/org/vaadin/console/client/ui/TextConsole.java	Tue May 17 18:50:45 2011 +0400
     1.2 +++ b/src/main/java/org/vaadin/console/client/ui/TextConsole.java	Wed May 18 00:43:34 2011 +0400
     1.3 @@ -262,19 +262,26 @@
     1.4      }
     1.5  
     1.6      protected void carriageReturn() {
     1.7 -        setPromtActive(false);
     1.8 -        // Append newline first if not there yet
     1.9 -        if (!bufferIsEmpty() && !bufferEndsWithNewLine()) {
    1.10 -            newLine();
    1.11 -            reducePrompt(-1);
    1.12 -        }
    1.13 -		if (config.isPrintPromptOnInput()) {
    1.14 +    	if (config.isPrintPromptOnInput()) {
    1.15 +    		setPromtActive(false);
    1.16 +    		// Append newline first if not there yet
    1.17 +    		if (!bufferIsEmpty() && !bufferEndsWithNewLine()) {
    1.18 +    			newLine();
    1.19 +    			reducePrompt(-1);
    1.20 +    		}
    1.21  			print(getCurrentPromptContent());
    1.22  			newLine();
    1.23 -		}
    1.24 -        if (promptRows > 1) {
    1.25 -            reducePrompt(-1);
    1.26 -        }
    1.27 +			if (promptRows > 1) {
    1.28 +				reducePrompt(-1);
    1.29 +			}
    1.30 +    	} else {
    1.31 +    		if (!bufferIsEmpty() && !bufferEndsWithNewLine()) {
    1.32 +		    	newLine();
    1.33 +		    	if (promptRows > 1) {
    1.34 +		    		reducePrompt(-1);
    1.35 +		    	}
    1.36 +    		}
    1.37 +    	}
    1.38          String lineBuffer = getInput();
    1.39          lineBuffer = lineBuffer.trim();
    1.40          if (!"".equals(lineBuffer)) {
    1.41 @@ -457,11 +464,12 @@
    1.42          setInput(inputText);
    1.43      }
    1.44      
    1.45 -    public void focusInput(){
    1.46 -        setPromtActive(true);
    1.47 -        scrollToEnd();
    1.48 -        ps.setInnerHTML(cleanPs);
    1.49 -    }
    1.50 +	public void focusInput() {
    1.51 +		if (isFocused())
    1.52 +			setPromtActive(true);
    1.53 +		scrollToEnd();
    1.54 +		ps.setInnerHTML(cleanPs);
    1.55 +	}
    1.56  
    1.57      public void scrollToEnd() {
    1.58          term.setScrollTop(BIG_NUMBER);