use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.
the class ShellWidget method output.
private boolean output(String text, String className, boolean addToTop) {
if (text.indexOf('\f') >= 0)
clearOutput();
Element outEl = output_.getElement();
if (addToTop) {
SpanElement leading = Document.get().createSpanElement();
outEl.insertFirst(leading);
VirtualConsole console = new VirtualConsole(leading);
console.submit(text, className);
lines_ += DomUtils.countLines(leading, true);
} else {
// create trailing output console if it doesn't already exist
if (virtualConsole_ == null) {
SpanElement trailing = Document.get().createSpanElement();
outEl.appendChild(trailing);
virtualConsole_ = new VirtualConsole(trailing);
}
int oldLineCount = DomUtils.countLines(virtualConsole_.getParent(), true);
virtualConsole_.submit(text, className);
int newLineCount = DomUtils.countLines(virtualConsole_.getParent(), true);
lines_ += newLineCount - oldLineCount;
}
boolean result = !trimExcess();
resizeCommand_.nudge();
return result;
}
use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.
the class VirtualConsoleTests method testFormFeed.
public void testFormFeed() {
PreElement ele = Document.get().createPreElement();
VirtualConsole vc = new VirtualConsole(ele);
vc.submit("Sample1\n");
vc.submit("Sample2\n");
vc.submit("Sample3\f");
vc.submit("Sample4");
Assert.assertEquals("<span>Sample4</span>", ele.getInnerHTML());
}
use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.
the class VirtualConsoleTests method testSimpleColor.
public void testSimpleColor() {
PreElement ele = Document.get().createPreElement();
VirtualConsole vc = new VirtualConsole(ele);
vc.submit("Error", "error");
Assert.assertEquals("<span class=\"error\">Error</span>", ele.getInnerHTML());
}
use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.
the class VirtualConsoleTests method testColorOverwrite.
public void testColorOverwrite() {
PreElement ele = Document.get().createPreElement();
VirtualConsole vc = new VirtualConsole(ele);
vc.submit("XXXX\r", "X");
vc.submit("YY", "Y");
Assert.assertEquals("<span class=\"Y\">YY</span>" + "<span class=\"X\">XX</span>", ele.getInnerHTML());
}
use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.
the class CompileOutputBuffer method clear.
@Override
public void clear() {
output_.setText("");
virtualConsole_ = new VirtualConsole(output_.getElement());
}
Aggregations