527 : -1); |
527 : -1); |
528 } |
528 } |
529 |
529 |
530 reducePrompt(linesAdded); |
530 reducePrompt(linesAdded); |
531 } |
531 } |
|
532 |
|
533 public void print(String string, String className) { |
|
534 if (isPromptActive()) { |
|
535 setPromtActive(false); |
|
536 if (!bufferIsEmpty() && !bufferEndsWithNewLine()) { |
|
537 newLine(); |
|
538 reducePrompt(-1); |
|
539 } |
|
540 string = getCurrentPromptContent() + string; |
|
541 } |
|
542 final boolean doWrap = config.isWrap(); |
|
543 // _log("print original: '" + string + "' (" + doWrap + ")"); |
|
544 String str = string.replaceAll("\t", tabs); |
|
545 int linesAdded = 0; |
|
546 |
|
547 Element classedChild = Document.get().createElement("span"); |
|
548 classedChild.addClassName(className); |
|
549 buffer.appendChild(classedChild); |
|
550 // Split by the newlines anyway |
|
551 int s = 0, e = str.indexOf('\n'); |
|
552 while (e >= s) { |
|
553 final String line = str.substring(s, e); |
|
554 linesAdded += appendLine(classedChild, line, doWrap ? cols : -1); |
|
555 classedChild.appendChild(createBr()); |
|
556 s = e + 1; |
|
557 e = str.indexOf('\n', s); |
|
558 } |
|
559 |
|
560 // Print the remaining string |
|
561 if (s < str.length()) { |
|
562 linesAdded += appendLine(classedChild, str.substring(s), doWrap ? cols : -1); |
|
563 } |
|
564 |
|
565 reducePrompt(linesAdded); |
|
566 } |
532 |
567 |
533 public void append(String string) { |
568 public void append(String string) { |
534 if (isPromptActive()) { |
569 if (isPromptActive()) { |
535 setPromtActive(false); |
570 setPromtActive(false); |
536 } |
571 } |
561 // Print the remaining string |
596 // Print the remaining string |
562 if (s < str.length()) { |
597 if (s < str.length()) { |
563 linesAdded += appendLine(buffer, str.substring(s), doWrap ? cols : -1); |
598 linesAdded += appendLine(buffer, str.substring(s), doWrap ? cols : -1); |
564 } |
599 } |
565 |
600 |
|
601 reducePrompt(linesAdded); |
|
602 } |
|
603 |
|
604 public void append(String string, String className) { |
|
605 if (isPromptActive()) { |
|
606 setPromtActive(false); |
|
607 } |
|
608 final boolean doWrap = config.isWrap(); |
|
609 // _log("print original: '" + string + "' (" + doWrap + ")"); |
|
610 String str = string.replaceAll("\t", tabs); |
|
611 int linesAdded = 0; |
|
612 |
|
613 Element classedChild = Document.get().createElement("span"); |
|
614 classedChild.addClassName(className); |
|
615 buffer.appendChild(classedChild); |
|
616 // Split by the newlines anyway |
|
617 int s = 0, e = str.indexOf('\n'); |
|
618 while (e >= s) { |
|
619 final String line = str.substring(s, e); |
|
620 linesAdded += appendLine(classedChild, line, doWrap ? cols : -1); |
|
621 classedChild.appendChild(createBr()); |
|
622 s = e + 1; |
|
623 e = str.indexOf('\n', s); |
|
624 } |
|
625 |
|
626 // Print the remaining string |
|
627 if (s < str.length()) { |
|
628 linesAdded += appendLine(classedChild, str.substring(s), doWrap ? cols : -1); |
|
629 } |
|
630 |
566 reducePrompt(linesAdded); |
631 reducePrompt(linesAdded); |
567 } |
632 } |
568 |
633 |
569 private String getCurrentPromptContent() { |
634 private String getCurrentPromptContent() { |
570 return prompt.getInnerText() + getInput(); |
635 return prompt.getInnerText() + getInput(); |
646 |
711 |
647 public void println(final String string) { |
712 public void println(final String string) { |
648 print(string + "\n"); |
713 print(string + "\n"); |
649 } |
714 } |
650 |
715 |
|
716 public void println(final String string, final String className) { |
|
717 print(string + "\n", className); |
|
718 } |
|
719 |
651 @Override |
720 @Override |
652 public void setHeight(final String height) { |
721 public void setHeight(final String height) { |
653 final int oldh = term.getClientHeight(); |
722 final int oldh = term.getClientHeight(); |
654 super.setHeight(height); |
723 super.setHeight(height); |
655 final int newh = term.getClientHeight(); |
724 final int newh = term.getClientHeight(); |